]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: build test files containing non-runnable examples
authorAndrew Gerrand <adg@golang.org>
Tue, 24 Jun 2014 22:22:22 +0000 (08:22 +1000)
committerAndrew Gerrand <adg@golang.org>
Tue, 24 Jun 2014 22:22:22 +0000 (08:22 +1000)
Even if we can't run them, we should at least check that they compile.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107320046

src/cmd/go/test.go

index 5935c98db9e82b1a6499a76cccded50e49c6ff1c..ac32181118befe8110691a0c9f56e1cc44aa24ed 100644 (file)
@@ -1177,12 +1177,12 @@ func (t *testFuncs) load(filename, pkg string, seen *bool) error {
        ex := doc.Examples(f)
        sort.Sort(byOrder(ex))
        for _, e := range ex {
+               *seen = true // Build the file even if the example is not runnable.
                if e.Output == "" && !e.EmptyOutput {
                        // Don't run examples with no output.
                        continue
                }
                t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output})
-               *seen = true
        }
        return nil
 }