diff
diff copied to clipboard
Bug: Nil slice == empty slices when diffing
At the moment, it seems nil/uninitialized slices are == initialized empty list slices.
type testStruct struct {
A []string
}
func Test_DiffNilList(t *testing.T) {
p := testStruct{}
assert.Nil(t, p.A)
n := testStruct{
A: []string{},
}
assert.NotNil(t, n.A)
res, err := diff.Diff(p, n)
if !assert.NoError(t, err) {
return
}
assert.Equal(t, 1, len(res))
}