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
This commit is contained in:
parent
71e1c68445
commit
59f09dcb8c
|
|
@ -195,9 +195,20 @@ func checkFiles(t *testing.T, testfiles []string) {
|
||||||
pkgName = files[0].Name.Name
|
pkgName = files[0].Name.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *listErrors {
|
||||||
|
t.Errorf("--- %s:", pkgName)
|
||||||
|
for _, err := range errlist {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// typecheck and collect typechecker errors
|
// typecheck and collect typechecker errors
|
||||||
var ctxt Context
|
var ctxt Context
|
||||||
ctxt.Error = func(err error) {
|
ctxt.Error = func(err error) {
|
||||||
|
if *listErrors {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
// Ignore error messages containing "previous declaration":
|
// Ignore error messages containing "previous declaration":
|
||||||
// They are follow-up error messages after a redeclaration
|
// They are follow-up error messages after a redeclaration
|
||||||
// error.
|
// error.
|
||||||
|
|
@ -208,10 +219,6 @@ func checkFiles(t *testing.T, testfiles []string) {
|
||||||
ctxt.Check(pkgName, fset, files...)
|
ctxt.Check(pkgName, fset, files...)
|
||||||
|
|
||||||
if *listErrors {
|
if *listErrors {
|
||||||
t.Errorf("--- %s: %d errors found", pkgName, len(errlist))
|
|
||||||
for _, err := range errlist {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue