check for type equality in deepequal

R=r,dnadasi
DELTA=9  (8 added, 0 deleted, 1 changed)
OCL=27473
CL=27486
This commit is contained in:
Russ Cox 2009-04-15 00:55:58 -07:00
parent 19692beee8
commit 64627b04fb
2 changed files with 10 additions and 2 deletions

View file

@ -310,7 +310,7 @@ func TestInterfaceValue(t *testing.T) {
assert(v2.Type().String(), "interface { }");
v3 := v2.(reflect.InterfaceValue).Value();
assert(v3.Type().String(), "float");
i3 := v2.Interface();
if f, ok := i3.(float); !ok {
a, typ, c := sys.Reflect(i3);
@ -387,6 +387,8 @@ type Basic struct {
y float32
}
type NotBasic Basic
type Recursive struct {
x int;
r *Recursive
@ -429,6 +431,7 @@ var deepEqualTests = []DeepEqualTest {
DeepEqualTest{ 0.5, "hello", false },
DeepEqualTest{ []int{ 1, 2, 3 }, [3]int{ 1, 2, 3 }, false },
DeepEqualTest{ &[3]interface{} { 1, 2, 4 }, &[3]interface{} { 1, 2, "s" }, false },
DeepEqualTest{ Basic{ 1, 0.5 }, NotBasic{ 1, 0.5 }, false },
}
func TestDeepEqual(t *testing.T) {