mirror of
https://github.com/golang/go
synced 2024-11-13 19:30:22 -07:00
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
This commit is contained in:
parent
63e3763af8
commit
eb4c3455de
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user