Skip to content

Commit ad539a3

Browse files
committed
The diff type from a slice/map value should not be forwarded
When a value in a slice/map results in a `TypesDiffer`, the resulting diff for the slice/map should be ContentDiffer
1 parent be8419a commit ad539a3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

diff/diff_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestDiff(t *testing.T) {
5151
Want: ContentDiffer,
5252
},
5353
{LHS: []interface{}{1, 2, 3}, RHS: []interface{}{1, 2, 3}, Want: Identical},
54-
{LHS: []interface{}{1, 2, 3}, RHS: []interface{}{1, 2, 3.3}, Want: TypesDiffer},
54+
{LHS: []interface{}{1, 2, 3}, RHS: []interface{}{1, 2, 3.3}, Want: ContentDiffer},
5555
{LHS: []interface{}(nil), RHS: []interface{}{1, 2, 3.3}, Want: ContentDiffer},
5656
{LHS: []int(nil), RHS: []int{}, Want: ContentDiffer},
5757
{LHS: func() {}, RHS: func() {}, Want: TypesDiffer, Error: true},

diff/map.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewMap(lhs, rhs interface{}) (*Map, error) {
5454
}, err
5555
}
5656
if diff.Diff() != Identical {
57-
Type = diff.Diff()
57+
Type = ContentDiffer
5858
}
5959
diffs[key.Interface()] = diff
6060
continue

diff/slice.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func NewSlice(lhs, rhs interface{}) (*Slice, error) {
5050
}, err
5151
}
5252
if diff.Diff() != Identical {
53-
Type = diff.Diff()
53+
Type = ContentDiffer
5454
}
5555
diffs = append(diffs, diff)
5656
continue

0 commit comments

Comments
 (0)