go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/assert/its_nil.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package assert 9 10 import "testing" 11 12 // ItsNil is an assertion helper. 13 // 14 // It will test that the given value is nil, printing 15 // the value if the value has a string form. 16 func ItsNil(t *testing.T, v any, message ...any) { 17 t.Helper() 18 if !Nil(v) { 19 Fatalf(t, "expected value to be <nil>, was %v", []any{v}, message) 20 } 21 } 22 23 // ItsNotNil is an assertion helper. 24 // 25 // It will test that the given value is not nil. 26 func ItsNotNil(t *testing.T, v any, message ...any) { 27 t.Helper() 28 if Nil(v) { 29 Fatalf(t, "expected value to not be <nil>", nil, message) 30 } 31 }