libgo: update to Go 1.11
[official-gcc.git] / libgo / go / cmd / go / testdata / script / mod_test.txt
blobcaeb25ada84583f12a796b3a4902d8049c2d1be9
1 env GO111MODULE=on
3 # A test in the module's root package should work.
4 cd a/
5 cp go.mod.empty go.mod
6 go test
7 stdout PASS
9 cp go.mod.empty go.mod
10 go list -deps
11 ! stdout ^testing$
13 # list all should include test dependencies, like testing
14 cp go.mod.empty go.mod
15 go list all
16 stdout ^testing$
17 stdout ^rsc.io/quote$
18 stdout ^rsc.io/testonly$
20 # list -deps -tests should also include testing
21 # but not deps of tests of deps (rsc.io/testonly).
22 go list -deps -test
23 stdout ^testing$
24 stdout ^rsc.io/quote$
25 ! stdout ^rsc.io/testonly$
27 # list -test all should succeed
28 cp go.mod.empty go.mod
29 go list -test all
30 stdout '^testing'
32 cp go.mod.empty go.mod
33 go test
34 stdout PASS
36 # A test with the "_test" suffix in the module root should also work.
37 cd ../b/
38 go test
39 stdout PASS
41 # A test with the "_test" suffix of a *package* with a "_test" suffix should
42 # even work (not that you should ever do that).
43 cd ../c_test
44 go test
45 stdout PASS
47 cd ../d_test
48 go test
49 stdout PASS
51 -- a/go.mod.empty --
52 module example.com/user/a
54 -- a/a.go --
55 package a
57 -- a/a_test.go --
58 package a
60 import "testing"
61 import _ "rsc.io/quote"
63 func Test(t *testing.T) {}
65 -- b/go.mod --
66 module example.com/user/b
68 -- b/b.go --
69 package b
71 -- b/b_test.go --
72 package b_test
74 import "testing"
76 func Test(t *testing.T) {}
78 -- c_test/go.mod --
79 module example.com/c_test
81 -- c_test/umm.go --
82 // Package c_test is the non-test package for its import path!
83 package c_test
85 -- c_test/c_test_test.go --
86 package c_test_test
88 import "testing"
90 func Test(t *testing.T) {}
92 -- d_test/go.mod --
93 // Package d is an ordinary package in a deceptively-named directory.
94 module example.com/d
96 -- d_test/d.go --
97 package d
99 -- d_test/d_test.go --
100 package d_test
102 import "testing"
104 func Test(t *testing.T) {}
106 -- e/go.mod --
107 module example.com/e_test
109 -- e/wat.go --
110 // Package e_test is the non-test package for its import path,
111 // in a deceptively-named directory!
112 package e_test
114 -- e/e_test.go --
115 package e_test_test
117 import "testing"
119 func Test(t *testing.T) {}