Commit c81293ad authored by Daniel Morsing's avatar Daniel Morsing

test: Make run.go's errorcheck behave like testlib.

testlib will complain about any unmatched errors left in errorchecks while run.go will not.

Fixes #4141.

R=golang-dev, minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6614060
parent 156d85c3
...@@ -522,7 +522,9 @@ func (t *test) errorCheck(outStr string, full, short string) (err error) { ...@@ -522,7 +522,9 @@ func (t *test) errorCheck(outStr string, full, short string) (err error) {
} }
if strings.HasPrefix(line, "\t") { if strings.HasPrefix(line, "\t") {
out[len(out)-1] += "\n" + line out[len(out)-1] += "\n" + line
} else { } else if strings.HasPrefix(line, "go tool") {
continue
} else if strings.TrimSpace(line) != "" {
out = append(out, line) out = append(out, line)
} }
} }
...@@ -553,6 +555,13 @@ func (t *test) errorCheck(outStr string, full, short string) (err error) { ...@@ -553,6 +555,13 @@ func (t *test) errorCheck(outStr string, full, short string) (err error) {
} }
} }
if len(out) > 0 {
errs = append(errs, fmt.Errorf("Unmatched Errors:"))
for _, errLine := range out {
errs = append(errs, fmt.Errorf("%s", errLine))
}
}
if len(errs) == 0 { if len(errs) == 0 {
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment