]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: convert TestGoGenerateBadImports to script framework
authorMichael Matloob <matloob@golang.org>
Mon, 30 Dec 2019 19:15:11 +0000 (14:15 -0500)
committerMichael Matloob <matloob@golang.org>
Mon, 6 Jan 2020 16:23:27 +0000 (16:23 +0000)
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Id1afafad2063d917fd55e08f0725ce3e93201c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/212878
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/go_test.go
src/cmd/go/testdata/script/generate_bad_imports.txt [new file with mode: 0644]
src/cmd/go/testdata/src/gencycle/gencycle.go [deleted file]

index 364186ff53fb2b577c6443f733c372f43323fa12..626fd46c36d70ec79627e9c9dac86c9320915da6 100644 (file)
@@ -2738,20 +2738,6 @@ func TestGoGenerateXTestPkgName(t *testing.T) {
        }
 }
 
-func TestGoGenerateBadImports(t *testing.T) {
-       if runtime.GOOS == "windows" {
-               t.Skip("skipping because windows has no echo command")
-       }
-
-       // This package has an invalid import causing an import cycle,
-       // but go generate is supposed to still run.
-       tg := testgo(t)
-       defer tg.cleanup()
-       tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
-       tg.run("generate", "gencycle")
-       tg.grepStdout("hello world", "go generate gencycle did not run generator")
-}
-
 func TestGoGetCustomDomainWildcard(t *testing.T) {
        testenv.MustHaveExternalNetwork(t)
        testenv.MustHaveExecPath(t, "git")
diff --git a/src/cmd/go/testdata/script/generate_bad_imports.txt b/src/cmd/go/testdata/script/generate_bad_imports.txt
new file mode 100644 (file)
index 0000000..59a2f57
--- /dev/null
@@ -0,0 +1,11 @@
+[windows] skip # skip because windows has no echo command
+
+go generate gencycle
+stdout 'hello world' # check go generate gencycle ran the generator
+
+-- gencycle/gencycle.go --
+//go:generate echo hello world
+
+package gencycle
+
+import _ "gencycle"
diff --git a/src/cmd/go/testdata/src/gencycle/gencycle.go b/src/cmd/go/testdata/src/gencycle/gencycle.go
deleted file mode 100644 (file)
index 600afd9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-//go:generate echo hello world
-
-package gencycle
-
-import _ "gencycle"