Skip to content

Commit 4a2279e

Browse files
Move test to test script
1 parent 17a04a7 commit 4a2279e

File tree

2 files changed

+57
-41
lines changed

2 files changed

+57
-41
lines changed

src/cmd/go/go_test.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,47 +2778,6 @@ func TestCoverpkgTestOnly(t *testing.T) {
27782778
tg.grepStdout("coverage: 100", "no coverage")
27792779
}
27802780

2781-
// regression test for github.com/golang/go/issues/66038
2782-
func TestCoverpkgIngoresSpecialDirs(t *testing.T) {
2783-
skipIfGccgo(t, "gccgo has no cover tool")
2784-
tooSlow(t, "links and runs a test binary with coverage enabled")
2785-
2786-
tg := testgo(t)
2787-
defer tg.cleanup()
2788-
2789-
wd, err := os.Getwd()
2790-
tg.check(err)
2791-
tg.makeTempdir()
2792-
tg.check(os.Chdir(tg.path(".")))
2793-
defer func() { tg.check(os.Chdir(wd)) }()
2794-
2795-
tg.tempFile("a/a.go", `package a
2796-
import ( _ "b" )
2797-
func F(i int) int {
2798-
return i*i
2799-
}`)
2800-
tg.tempFile("a/a_test.go", `
2801-
package a
2802-
import ( "testing" )
2803-
func TestF(t *testing.T) { F(2) }
2804-
`)
2805-
2806-
for _, skipDir := range []string{".dir", "_dir", "testdata", "dir/testdata"} {
2807-
t.Run(skipDir, func(t *testing.T) {
2808-
tg.tempFile(fmt.Sprintf("%s/src/b/b.go", skipDir), `package b
2809-
func G(i int) int {
2810-
return i*i
2811-
}`)
2812-
tg.setenv("GOPATH", tg.path(skipDir))
2813-
2814-
tg.run("test", "-coverpkg=./...", "./...")
2815-
2816-
tg.grepStderrNot("no packages being tested depend on matches", "bad match message")
2817-
tg.grepStdout("coverage: 100", "no coverage")
2818-
})
2819-
}
2820-
}
2821-
28222781
// Regression test for golang.org/issue/34499: version command should not crash
28232782
// when executed in a deleted directory on Linux.
28242783
func TestExecInDeletedDir(t *testing.T) {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# test for https://github.com/golang/go/issues/66038
2+
[short] skip
3+
4+
env GO111MODULE=off
5+
# files
6+
env GOPATH=$WORK/.dir${:}$WORK/_dir${:}$WORK/testdata
7+
8+
cd $WORK
9+
go test -coverpkg=./... ./...
10+
stdout 'coverage: 100.0%'
11+
12+
-- $WORK/a.go --
13+
package a
14+
15+
// trivial function with 100% test coverage
16+
17+
import (
18+
_ "dot_dir"
19+
_ "under_dir"
20+
_ "testdata_dir"
21+
)
22+
23+
func F(i int) int {
24+
return i*i
25+
}
26+
27+
-- $WORK/a_test.go --
28+
package a
29+
30+
import (
31+
"testing"
32+
)
33+
34+
func TestF(t *testing.T) {
35+
F(2)
36+
}
37+
38+
-- $WORK/.dir/src/dot_dir/b.go --
39+
package dot_dir
40+
41+
func G(i int) int {
42+
return i*i
43+
}
44+
45+
-- $WORK/.dir/src/under_dir/b.go --
46+
package dot_dir
47+
48+
func G(i int) int {
49+
return i*i
50+
}
51+
52+
-- $WORK/testdata/src/testdata_dir/b.go --
53+
package testdata_dir
54+
55+
func G(i int) int {
56+
return i*i
57+
}

0 commit comments

Comments
 (0)