mirror of
https://github.com/golang/go
synced 2024-11-23 20:40:07 -07:00
cmd/go: convert TestGoTestBuildsAnXtestContainingOnly... to the script framework
The name of the test is too long to fit on the first line. It's TestGoTestBuildsAnXtestContainingOnlyNonRunnableExamples. Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: I490748271b10a85cbe1d34f9dbecb86ccf0101a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/214423 Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
bec91cecef
commit
1c4e5152ae
@ -1832,13 +1832,6 @@ func TestListTemplateContextFunction(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGoTestBuildsAnXtestContainingOnlyNonRunnableExamples(t *testing.T) {
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.run("test", "-v", "./testdata/norunexample")
|
||||
tg.grepStdout("File with non-runnable example was built.", "file with non-runnable example was not built")
|
||||
}
|
||||
|
||||
// Test that you cannot use a local import in a package
|
||||
// accessed by a non-local import (found in a GOPATH/GOROOT).
|
||||
// See golang.org/issue/17475.
|
||||
|
11
src/cmd/go/testdata/norunexample/example_test.go
vendored
11
src/cmd/go/testdata/norunexample/example_test.go
vendored
@ -1,11 +0,0 @@
|
||||
package pkg_test
|
||||
|
||||
import "os"
|
||||
|
||||
func init() {
|
||||
os.Stdout.Write([]byte("File with non-runnable example was built.\n"))
|
||||
}
|
||||
|
||||
func Example_test() {
|
||||
// This test will not be run, it has no "Output:" comment.
|
||||
}
|
10
src/cmd/go/testdata/norunexample/test_test.go
vendored
10
src/cmd/go/testdata/norunexample/test_test.go
vendored
@ -1,10 +0,0 @@
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuilt(t *testing.T) {
|
||||
os.Stdout.Write([]byte("A normal test was executed.\n"))
|
||||
}
|
26
src/cmd/go/testdata/script/test_no_run_example.txt
vendored
Normal file
26
src/cmd/go/testdata/script/test_no_run_example.txt
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
go test -v norunexample
|
||||
stdout 'File with non-runnable example was built.'
|
||||
|
||||
-- norunexample/example_test.go --
|
||||
package pkg_test
|
||||
|
||||
import "os"
|
||||
|
||||
func init() {
|
||||
os.Stdout.Write([]byte("File with non-runnable example was built.\n"))
|
||||
}
|
||||
|
||||
func Example_test() {
|
||||
// This test will not be run, it has no "Output:" comment.
|
||||
}
|
||||
-- norunexample/test_test.go --
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuilt(t *testing.T) {
|
||||
os.Stdout.Write([]byte("A normal test was executed.\n"))
|
||||
}
|
Loading…
Reference in New Issue
Block a user