From 4fd305d5dc4a4a8854a05aa01b9f9960cae18d68 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Tue, 30 Sep 2014 12:12:40 -0400 Subject: [PATCH] go/types: remove surplus (obsolete) lines from test expectation. Also add assertion that there are no surplus lines. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/151890043 --- go/types/api_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/go/types/api_test.go b/go/types/api_test.go index 87f220f8..0accef07 100644 --- a/go/types/api_test.go +++ b/go/types/api_test.go @@ -719,12 +719,7 @@ func main() { _ = (*B).f }` - // TODO(adonovan): assert all map entries are used at least once. wantOut := map[string][2]string{ - "lib.T": {"qualified ident type lib.T float64", ".[]"}, - "lib.C": {"qualified ident const lib.C lib.T", ".[]"}, - "lib.F": {"qualified ident func lib.F()", ".[]"}, - "lib.V": {"qualified ident var lib.V lib.T", ".[]"}, "lib.T.M": {"method expr (lib.T) M(lib.T)", ".[0]"}, "A{}.B": {"field (main.A) B *main.B", ".[0]"}, @@ -775,6 +770,7 @@ func main() { if want != got { t.Errorf("%s: got %q; want %q", syntax, got, want) } + delete(wantOut, syntax) // We must explicitly assert properties of the // Signature's receiver since it doesn't participate @@ -790,6 +786,10 @@ func main() { t.Error("%s: signature has receiver %s", sig, sig.Recv().Type()) } } + // Assert that all wantOut entries were used exactly once. + for syntax := range wantOut { + t.Errorf("no ast.Selection found with syntax %q", syntax) + } } func TestIssue8518(t *testing.T) {