1 ! go test -json .
2
3 # We should see only JSON output on stdout, no non-JSON.
4 # To simplify the check, we just look for non-curly-braces, since
5 # every JSON entry has them and they're unlikely to occur
6 # in other error messages.
7 ! stdout '^[^{]'
8 ! stdout '[^}]\n$'
9
10 # Since the only test we requested failed to build, we should
11 # not see any "pass" actions in the JSON stream.
12 ! stdout '\{.*"Action":"pass".*\}'
13
14 # TODO(#62067): emit this as a build event instead of a test event.
15 stdout '\{.*"Action":"output","Package":"example","Output":"FAIL\\texample \[build failed\]\\n"\}'
16 stdout '\{.*"Action":"fail","Package":"example",.*\}'
17
18 -- go.mod --
19 module example
20 go 1.19
21 -- example.go --
22 package example
23
24 This is not valid Go source.
25 -- example_test.go --
26 package example
27
28 func Test(*testing.T) {}
29
View as plain text