Skip to content

Commit 9d9e5cd

Browse files
committed
inline nilfunc to nil comparison
1 parent 6a81ba1 commit 9d9e5cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

decode_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func Test_Decoder(t *testing.T) {
173173
assertEq(t, "struct.D.AA", 2, v.D.AA)
174174
assertEq(t, "struct.D.BB", "world", v.D.BB)
175175
assertEq(t, "struct.D.CC", true, v.D.CC)
176-
assertEq(t, "struct.E", nil, v.E)
176+
assertEq(t, "struct.E", true, v.E == nil)
177177
t.Run("struct.field null", func(t *testing.T) {
178178
var v struct {
179179
A string
@@ -195,7 +195,7 @@ func Test_Decoder(t *testing.T) {
195195
assertNeq(t, "array", v.E, nil)
196196
assertEq(t, "array", len(v.E), 2)
197197
assertEq(t, "interface{}", v.F, nil)
198-
assertEq(t, "func", v.G, nil)
198+
assertEq(t, "nilfunc", true, v.G == nil)
199199
})
200200
})
201201
t.Run("interface", func(t *testing.T) {
@@ -247,7 +247,7 @@ func Test_Decoder(t *testing.T) {
247247
t.Run("func", func(t *testing.T) {
248248
var v func()
249249
assertErr(t, json.Unmarshal([]byte(`null`), &v))
250-
assertEq(t, "func", nil, v)
250+
assertEq(t, "nilfunc", true, v == nil)
251251
})
252252
}
253253

0 commit comments

Comments
 (0)