From 59f09dcb8c3181713b3c7c10e66cb899f15fcd61 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 10 Jul 2013 22:19:43 -0700 Subject: [PATCH] go.tools/go/types: report test errors immediately in -list mode This way, errors reported before a crash are visible. R=adonovan, r CC=golang-dev https://golang.org/cl/10802044 --- go/types/check_test.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/go/types/check_test.go b/go/types/check_test.go index 57696a8d..7e2b7919 100644 --- a/go/types/check_test.go +++ b/go/types/check_test.go @@ -195,9 +195,20 @@ func checkFiles(t *testing.T, testfiles []string) { pkgName = files[0].Name.Name } + if *listErrors { + t.Errorf("--- %s:", pkgName) + for _, err := range errlist { + t.Error(err) + } + } + // typecheck and collect typechecker errors var ctxt Context ctxt.Error = func(err error) { + if *listErrors { + t.Error(err) + return + } // Ignore error messages containing "previous declaration": // They are follow-up error messages after a redeclaration // error. @@ -208,10 +219,6 @@ func checkFiles(t *testing.T, testfiles []string) { ctxt.Check(pkgName, fset, files...) if *listErrors { - t.Errorf("--- %s: %d errors found", pkgName, len(errlist)) - for _, err := range errlist { - t.Error(err) - } return }