Fix assertMapEqual so it compares Value.Interface()
One should not use == to compare to instances of Value, since they will be
pointers. Rather, one should call .Interface() on the Value instances
before performing the comparison.
diff --git a/diffmatchpatch/dmp_test.go b/diffmatchpatch/dmp_test.go
index 34d696e..df1e207 100644
--- a/diffmatchpatch/dmp_test.go
+++ b/diffmatchpatch/dmp_test.go
@@ -60,14 +60,14 @@
}
for _, key1 := range keys1 {
- if a, b := v2.MapIndex(key1), v1.MapIndex(key1); a != b {
- t.Fatal("%v Different key/value in Map: %v != %v", caller(), a, b)
+ if a, b := v2.MapIndex(key1).Interface(), v1.MapIndex(key1).Interface(); a != b {
+ t.Fatalf("%v Different key/value in Map: %v != %v", caller(), a, b)
}
}
for _, key2 := range keys2 {
- if a, b := v1.MapIndex(key2), v2.MapIndex(key2); a != b {
- t.Fatal("%v Different key/value in Map: %v != %v", caller(), a, b)
+ if a, b := v1.MapIndex(key2).Interface(), v2.MapIndex(key2).Interface(); a != b {
+ t.Fatalf("%v Different key/value in Map: %v != %v", caller(), a, b)
}
}
}