From ad277871f55a5749ac12fbb3b95714c3855d22f3 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sat, 6 Jan 2018 17:03:36 +1100 Subject: [PATCH] Fix lang/check tests --- lang/check/check_test.go | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lang/check/check_test.go b/lang/check/check_test.go index 59627340..90f476c1 100644 --- a/lang/check/check_test.go +++ b/lang/check/check_test.go @@ -117,22 +117,26 @@ func TestCheck(tt *testing.T) { tt.Fatalf("Check: %v", err) } - funcs := c.Funcs() - if len(funcs) != 1 { - tt.Fatalf("Funcs: got %d elements, want 1", len(funcs)) + if len(c.funcs) != 1 { + tt.Fatalf("Funcs: got %d elements, want 1", len(c.funcs)) } - fooBar := Func{} - for _, f := range funcs { + fooBar := (*a.Func)(nil) + fooBarLocalVars := typeMap(nil) + for _, f := range c.funcs { fooBar = f break } + for _, v := range c.localVars { + fooBarLocalVars = v + break + } - if got, want := fooBar.QQID.Str(tm), "foo.bar"; got != want { + if got, want := fooBar.QQID().Str(tm), "foo.bar"; got != want { tt.Fatalf("Funcs[0] name: got %q, want %q", got, want) } got := [][2]string(nil) - for id, typ := range fooBar.LocalVars { + for id, typ := range fooBarLocalVars { got = append(got, [2]string{ id.Str(tm), typ.Str(tm), @@ -215,17 +219,16 @@ func TestConstValues(tt *testing.T) { continue } - funcs := c.Funcs() - if len(funcs) != 1 { - tt.Errorf("%q: Funcs: got %d elements, want 1", s, len(funcs)) + if len(c.funcs) != 1 { + tt.Errorf("%q: Funcs: got %d elements, want 1", s, len(c.funcs)) continue } - foo := Func{} - for _, f := range funcs { + foo := (*a.Func)(nil) + for _, f := range c.funcs { foo = f break } - body := foo.Func.Body() + body := foo.Body() if len(body) != 1 { tt.Errorf("%q: Body: got %d elements, want 1", s, len(body)) continue