]> Cypherpunks repositories - gostls13.git/commitdiff
test: Make run.go's errorcheck behave like testlib.
authorDaniel Morsing <daniel.morsing@gmail.com>
Mon, 8 Oct 2012 14:36:45 +0000 (16:36 +0200)
committerDaniel Morsing <daniel.morsing@gmail.com>
Mon, 8 Oct 2012 14:36:45 +0000 (16:36 +0200)
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

test/run.go

index b6437ee1d332d515f0d885d83f5dd2a6e88a31d3..b79323dd17938f230357cc3476cf70ba0f2c57a9 100644 (file)
@@ -522,7 +522,9 @@ func (t *test) errorCheck(outStr string, full, short string) (err error) {
                }
                if strings.HasPrefix(line, "\t") {
                        out[len(out)-1] += "\n" + line
-               } else {
+               } else if strings.HasPrefix(line, "go tool") {
+                       continue
+               } else if strings.TrimSpace(line) != "" {
                        out = append(out, line)
                }
        }
@@ -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 {
                return nil
        }