Skip to content

Commit

Permalink
Merge pull request #7 from ifraixedes/avoid-panics-on-arrays
Browse files Browse the repository at this point in the history
Avoid panics on arrays
  • Loading branch information
d4l3k committed Jul 8, 2016
2 parents c00888b + 77ce413 commit a4b5f1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion messagediff.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (d *Diff) diff(aVal, bVal reflect.Value, path Path) bool {

equal := true
switch kind {
case reflect.Array, reflect.Map, reflect.Ptr, reflect.Func, reflect.Chan, reflect.Slice:
case reflect.Map, reflect.Ptr, reflect.Func, reflect.Chan, reflect.Slice:
if aVal.IsNil() && bVal.IsNil() {
return true
}
Expand Down
5 changes: 3 additions & 2 deletions messagediff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
type testStruct struct {
A, b int
C []int
D [3]int
}

type RecursiveStruct struct {
Expand Down Expand Up @@ -90,8 +91,8 @@ func TestPrettyDiff(t *testing.T) {
false,
},
{
testStruct{1, 2, []int{1}},
testStruct{1, 3, []int{1, 2}},
testStruct{1, 2, []int{1}, [3]int{4, 5, 6}},
testStruct{1, 3, []int{1, 2}, [3]int{4, 5, 6}},
"added: .C[1] = 2\nmodified: .b = 3\n",
false,
},
Expand Down

0 comments on commit a4b5f1b

Please sign in to comment.