fix order-dependent test

TestSdumpLargeDefinition is depnding on a global state change in
TestSdumpReusedPointers. It can't pass if it runs in the wrong order.

Fixes internal auto-filled bug.
This commit is contained in:
Mike Danese 2020-04-01 20:23:34 -07:00 committed by Stanisław Barzowski
parent 4f4aa80dd7
commit b2dbc0c524

View File

@ -447,8 +447,9 @@ var Obj = &struct { Foo *Zeo; Bar *Zeo }{
},
}
for _, test := range testcases {
Config.StripPackageNames = true
output := Sdump(test.input())
opts := Config
opts.StripPackageNames = true
output := opts.Sdump(test.input())
if test.expected != output {
t.Errorf("test case %s failed, expected : \n%#v\n, got : \n%#v", test.name, test.expected, output)
}
@ -465,7 +466,7 @@ func TestSdumpLargeDefinition(t *testing.T) {
}
got := Sdump(&largeStruct{1, 2, 3, 4, 5})
want := `var Obj = _Obj
var _Obj = &largeStruct{
var _Obj = &dump.largeStruct{
ABCDEFGHIJKLMNOBQRSTUVWXYZ0: int(1),
ABCDEFGHIJKLMNOBQRSTUVWXYZ1: int(2),
ABCDEFGHIJKLMNOBQRSTUVWXYZ2: int(3),