1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00

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
This commit is contained in:
Alan Donovan 2014-09-30 12:12:40 -04:00
parent 0e613cdb27
commit 4fd305d5dc

View File

@ -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) {