aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/list_test_err.txt
blob: c6f1ecf40039097acadbde2977f817bf52f17c74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
env GO111MODULE=off

# issue 28491: errors in test source files should not prevent
# "go list -test" from returning useful information.

# go list prints information for package, internal test,
# external test, but not testmain package when there is a
# syntax error in test sources.
! go list -test -deps syntaxerr
stdout pkgdep
stdout testdep_a
stdout testdep_b
stdout ^syntaxerr$
stdout '^syntaxerr \[syntaxerr.test\]'
stdout '^syntaxerr_test \[syntaxerr.test\]'
! stdout '^syntaxerr\.test'
stderr 'expected declaration'

# go list -e prints information for all test packages.
# The syntax error is shown in the package error field.
go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' syntaxerr
stdout 'pkgdep <nil>'
stdout 'testdep_a <nil>'
stdout 'testdep_b <nil>'
stdout 'syntaxerr <nil>'
stdout 'syntaxerr \[syntaxerr.test\] <nil>'
stdout 'syntaxerr_test \[syntaxerr.test\] <nil>'
stdout 'syntaxerr\.test "[^"]*expected declaration'
! stderr 'expected declaration'

[short] stop

# go list prints partial information with test naming error
! go list -test -deps nameerr
stdout pkgdep
stdout testdep_a
stdout testdep_b
stderr 'wrong signature for TestBad'

go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' nameerr
stdout 'pkgdep <nil>'
stdout 'testdep_a <nil>'
stdout 'testdep_b <nil>'
stdout 'nameerr\.test "[^"]*wrong signature for TestBad'
! stderr 'wrong signature for TestBad'

# go list prints partial information with error if test has cyclic import
! go list -test -deps cycleerr
stdout cycleerr
stderr 'import cycle not allowed in test'

go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' cycleerr
stdout 'cycleerr <nil>'
stdout 'testdep_a <nil>'
stdout 'testdep_cycle <nil>'
stdout 'cycleerr \[cycleerr.test\] "[^"]*import cycle not allowed in test'
! stderr 'import cycle not allowed in test'

-- syntaxerr/syntaxerr.go --
package syntaxerr

import _ "pkgdep"

-- syntaxerr/syntaxerr_ie_test.go --
package syntaxerr

!!!syntax error

-- syntaxerr/syntaxerr_xe_test.go --
package syntaxerr_test

!!!syntax error

-- syntaxerr/syntaxerr_i_test.go --
package syntaxerr

import _ "testdep_a"

-- syntaxerr/syntaxerr_x_test.go --
package syntaxerr

import _ "testdep_b"

-- nameerr/nameerr.go --
package nameerr

import _ "pkgdep"

-- nameerr/nameerr_i_test.go --
package nameerr

import (
  _ "testdep_a"
  "testing"
)

func TestBad(t *testing.B) {}

-- nameerr/nameerr_x_test.go --
package nameerr_test

import (
  _ "testdep_b"
  "testing"
)

func TestBad(t *testing.B) {}

-- cycleerr/cycleerr_test.go --
package cycleerr

import (
  _ "testdep_a"
  _ "testdep_cycle"
)

-- pkgdep/pkgdep.go --
package pkgdep

-- testdep_a/testdep_a.go --
package testdep_a

-- testdep_b/testdep_b.go --
package testdep_b

-- testdep_cycle/testdep_cycle.go --
package testdep_cycle

import _ "cycleerr"