Commit eb4c3455 authored by Andrew Gerrand's avatar Andrew Gerrand

cmd/go: build test files containing non-runnable examples

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
parent 63e3763a
...@@ -1177,12 +1177,12 @@ func (t *testFuncs) load(filename, pkg string, seen *bool) error { ...@@ -1177,12 +1177,12 @@ func (t *testFuncs) load(filename, pkg string, seen *bool) error {
ex := doc.Examples(f) ex := doc.Examples(f)
sort.Sort(byOrder(ex)) sort.Sort(byOrder(ex))
for _, e := range ex { for _, e := range ex {
*seen = true // Build the file even if the example is not runnable.
if e.Output == "" && !e.EmptyOutput { if e.Output == "" && !e.EmptyOutput {
// Don't run examples with no output. // Don't run examples with no output.
continue continue
} }
t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output}) t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output})
*seen = true
} }
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