...
1env GO111MODULE=on
2
3# go list -compiled -test must handle test-only packages
4# golang.org/issue/27097.
5go list -compiled -test
6stdout -count=4 '^.' # 4 lines
7stdout '^m$'
8stdout '^m\.test$'
9stdout '^m \[m\.test\]$'
10stdout '^m_test \[m\.test\]$'
11
12# https://golang.org/issue/39974: test packages should have the Module field populated.
13go list -test -f '{{.ImportPath}}{{with .Module}}: {{.Path}}{{end}}'
14stdout -count=4 '^.' # 4 lines
15stdout '^m: m$'
16stdout '^m\.test: m$'
17stdout '^m \[m\.test\]: m$'
18stdout '^m_test \[m\.test\]: m$'
19
20-- go.mod --
21module m
22
23-- x_test.go --
24package x
25import "testing"
26func Test(t *testing.T) {}
27-- x_x_test.go --
28package x_test
29import "testing"
30func Test(t *testing.T) {}
View as plain text