mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
testdata: re-add reflect.DeepEqual test case
This commit is contained in:
@@ -1083,6 +1083,21 @@ type structWithSelfPtr struct {
|
|||||||
s string
|
s string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type deepEqualInterface interface {
|
||||||
|
Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
type deepEqualConcrete struct {
|
||||||
|
int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (deepEqualConcrete) Foo() {}
|
||||||
|
|
||||||
|
var (
|
||||||
|
deepEqualConcrete1 = deepEqualConcrete{1}
|
||||||
|
deepEqualConcrete2 = deepEqualConcrete{2}
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
loop1 = &loop2
|
loop1 = &loop2
|
||||||
loop2 = &loop1
|
loop2 = &loop1
|
||||||
@@ -1115,6 +1130,7 @@ var deepEqualTests = []DeepEqualTest{
|
|||||||
{[]byte{1, 2, 3}, []byte{1, 2, 3}, true},
|
{[]byte{1, 2, 3}, []byte{1, 2, 3}, true},
|
||||||
{[]MyByte{1, 2, 3}, []MyByte{1, 2, 3}, true},
|
{[]MyByte{1, 2, 3}, []MyByte{1, 2, 3}, true},
|
||||||
{MyBytes{1, 2, 3}, MyBytes{1, 2, 3}, true},
|
{MyBytes{1, 2, 3}, MyBytes{1, 2, 3}, true},
|
||||||
|
{map[deepEqualInterface]string{deepEqualConcrete1: "a"}, map[deepEqualInterface]string{deepEqualConcrete1: "a"}, true},
|
||||||
|
|
||||||
// Inequalities
|
// Inequalities
|
||||||
{1, 2, false},
|
{1, 2, false},
|
||||||
@@ -1136,6 +1152,7 @@ var deepEqualTests = []DeepEqualTest{
|
|||||||
{fn3, fn3, false},
|
{fn3, fn3, false},
|
||||||
{[][]int{{1}}, [][]int{{2}}, false},
|
{[][]int{{1}}, [][]int{{2}}, false},
|
||||||
{&structWithSelfPtr{p: &structWithSelfPtr{s: "a"}}, &structWithSelfPtr{p: &structWithSelfPtr{s: "b"}}, false},
|
{&structWithSelfPtr{p: &structWithSelfPtr{s: "a"}}, &structWithSelfPtr{p: &structWithSelfPtr{s: "b"}}, false},
|
||||||
|
{map[deepEqualInterface]string{deepEqualConcrete1: "a"}, map[deepEqualInterface]string{deepEqualConcrete2: "a"}, false},
|
||||||
|
|
||||||
// Fun with floating point.
|
// Fun with floating point.
|
||||||
{math.NaN(), math.NaN(), false},
|
{math.NaN(), math.NaN(), false},
|
||||||
|
|||||||
Reference in New Issue
Block a user