]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: convert TestIssue12096 to the script framework
authorMichael Matloob <matloob@golang.org>
Fri, 10 Jan 2020 23:04:08 +0000 (18:04 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 19 Feb 2020 21:18:17 +0000 (21:18 +0000)
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I27e52c4eabfcd1782965f17c098719dd0ea7e3ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/214390
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/go_test.go
src/cmd/go/testdata/script/test_env_term.txt [new file with mode: 0644]

index 2c829f38b695988779aa501d715d856841c6499c..2e075656484a21cb51759e1899c6a05ddb9c62c6 100644 (file)
@@ -2189,21 +2189,6 @@ func TestIssue11709(t *testing.T) {
        tg.run("run", tg.path("run.go"))
 }
 
-func TestIssue12096(t *testing.T) {
-       tg := testgo(t)
-       defer tg.cleanup()
-       tg.tempFile("test_test.go", `
-               package main
-               import ("os"; "testing")
-               func TestEnv(t *testing.T) {
-                       if os.Getenv("TERM") != "" {
-                               t.Fatal("TERM is set")
-                       }
-               }`)
-       tg.unsetenv("TERM")
-       tg.run("test", tg.path("test_test.go"))
-}
-
 func TestGoBuildARM(t *testing.T) {
        if testing.Short() {
                t.Skip("skipping cross-compile in short mode")
diff --git a/src/cmd/go/testdata/script/test_env_term.txt b/src/cmd/go/testdata/script/test_env_term.txt
new file mode 100644 (file)
index 0000000..8a5f79a
--- /dev/null
@@ -0,0 +1,15 @@
+# Tests golang.org/issue/12096
+
+env TERM=''
+go test test_test.go
+! stdout '^ok.*\[no tests to run\]'
+stdout '^ok'
+
+-- test_test.go --
+package main
+import ("os"; "testing")
+func TestEnv(t *testing.T) {
+       if os.Getenv("TERM") != "" {
+               t.Fatal("TERM is set")
+       }
+}
\ No newline at end of file