...
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.
15stdout '\{.*"Action":"output","Package":"example","Output":"FAIL\\texample \[build failed\]\\n"\}'
16stdout '\{.*"Action":"fail","Package":"example",.*\}'
17
18-- go.mod --
19module example
20go 1.19
21-- example.go --
22package example
23
24This is not valid Go source.
25-- example_test.go --
26package example
27
28func Test(*testing.T) {}
View as plain text