Skip to content

Commit 1a7c02d

Browse files
authored
Merge pull request #6 from danielkroes/fix-nil-check
Remove error from nil-check
2 parents da9045d + 3c7865b commit 1a7c02d

File tree

5 files changed

+1
-17
lines changed

5 files changed

+1
-17
lines changed

assert/assert.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,8 +2798,6 @@ func NotContainsUintptr(t testing.T,
27982798
}
27992799

28002800
// Nil tests if the passed value is Nil. See also Empty.
2801-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2802-
// the zero value type (ie: the nil keyword).
28032801
// msg is an optional list of arguments following the `fmt.Printf()` format.
28042802
func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28052803
if h, ok := t.(testing.Helper); ok {
@@ -2818,8 +2816,6 @@ func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28182816
}
28192817

28202818
// NotNil tests if the passed value is not Nil. See also NotEmpty.
2821-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2822-
// the zero value type (ie: the nil keyword).
28232819
// msg is an optional list of arguments following the `fmt.Printf()` format.
28242820
func NotNil(t testing.T, tval interface{}, msg ...interface{}) bool {
28252821
if h, ok := t.(testing.Helper); ok {

expect/expect.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,8 +2798,6 @@ func NotContainsUintptr(t testing.T,
27982798
}
27992799

28002800
// Nil tests if the passed value is Nil. See also Empty.
2801-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2802-
// the zero value type (ie: the nil keyword).
28032801
// msg is an optional list of arguments following the `fmt.Printf()` format.
28042802
func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28052803
if h, ok := t.(testing.Helper); ok {
@@ -2818,8 +2816,6 @@ func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28182816
}
28192817

28202818
// NotNil tests if the passed value is not Nil. See also NotEmpty.
2821-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2822-
// the zero value type (ie: the nil keyword).
28232819
// msg is an optional list of arguments following the `fmt.Printf()` format.
28242820
func NotNil(t testing.T, tval interface{}, msg ...interface{}) bool {
28252821
if h, ok := t.(testing.Helper); ok {

internal/assert.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ func NotEqualTypes(t testing.T,
236236
{{ end }}
237237

238238
// Nil tests if the passed value is Nil. See also Empty.
239-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
240-
// the zero value type (ie: the nil keyword).
241239
{{ $msgfmtcomment }}
242240
func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
243241
{{- template "helper" "t" }}
@@ -253,8 +251,6 @@ func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
253251
}
254252

255253
// NotNil tests if the passed value is not Nil. See also NotEmpty.
256-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
257-
// the zero value type (ie: the nil keyword).
258254
{{ $msgfmtcomment }}
259255
func NotNil(t testing.T, tval interface{}, msg ...interface{}) bool {
260256
{{- template "helper" "t" }}

internal/cmp/nil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Nil(nullable interface{}) (ok bool, err error) {
2222
case reflect.Slice:
2323
case reflect.UnsafePointer:
2424
default:
25-
return false, fmt.Errorf("(%T) is not a nullable type", nullable)
25+
return false, nil
2626
}
2727

2828
defer func() {

internal/tests/tests.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,8 +2798,6 @@ func NotContainsUintptr(t testing.T,
27982798
}
27992799

28002800
// Nil tests if the passed value is Nil. See also Empty.
2801-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2802-
// the zero value type (ie: the nil keyword).
28032801
// msg is an optional list of arguments following the `fmt.Printf()` format.
28042802
func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28052803
if h, ok := t.(testing.Helper); ok {
@@ -2818,8 +2816,6 @@ func Nil(t testing.T, tval interface{}, msg ...interface{}) bool {
28182816
}
28192817

28202818
// NotNil tests if the passed value is not Nil. See also NotEmpty.
2821-
// Makes sense solely on chan, func, interface, map, pointer, slice value and
2822-
// the zero value type (ie: the nil keyword).
28232819
// msg is an optional list of arguments following the `fmt.Printf()` format.
28242820
func NotNil(t testing.T, tval interface{}, msg ...interface{}) bool {
28252821
if h, ok := t.(testing.Helper); ok {

0 commit comments

Comments
 (0)