1 # Build something to create the executable, including several cases
2 [short] skip
3
4 # --------------------- clean executables -------------------------
5
6 # case1: test file-named executable 'main'
7 env GO111MODULE=on
8
9 ! exists main$GOEXE
10 go build main.go
11 exists -exec main$GOEXE
12 go clean
13 ! exists main$GOEXE
14
15 # case2: test module-named executable 'a.b.c'
16 ! exists a.b.c$GOEXE
17 go build
18 exists -exec a.b.c$GOEXE
19 go clean
20 ! exists a.b.c$GOEXE
21
22 # case3: directory-named executable 'src'
23 env GO111MODULE=off
24
25 ! exists src$GOEXE
26 go build
27 exists -exec src$GOEXE
28 go clean
29 ! exists src$GOEXE
30
31 # --------------------- clean test files -------------------------
32
33 # case1: test file-named test file
34 env GO111MODULE=on
35
36 ! exists main.test$GOEXE
37 go test -c main_test.go
38 exists -exec main.test$GOEXE
39 go clean
40 ! exists main.test$GOEXE
41
42 # case2: test module-named test file
43 ! exists a.b.c.test$GOEXE
44 go test -c
45 exists -exec a.b.c.test$GOEXE
46 go clean
47 ! exists a.b.c.test$GOEXE
48
49 # case3: test directory-based test file
50 env GO111MODULE=off
51
52 ! exists src.test$GOEXE
53 go test -c
54 exists -exec src.test$GOEXE
55 go clean
56 ! exists src.test$GOEXE
57
58 -- main.go --
59 package main
60
61 import "fmt"
62
63 func main() {
64 fmt.Println("hello!")
65 }
66
67 -- main_test.go --
68 package main
69
70 import "testing"
71
72 func TestSomething(t *testing.T) {
73 }
74
75 -- go.mod --
76 module example.com/a.b.c/v2
77
78 go 1.12
View as plain text