-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test2json: use indentation to determine source of test output
If a test prints output after a subtest has started it was being attributed to the last subtest. This change uses the identation level of the output to determine which test the output comes from.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{"Action":"run","Test":"TestOutputWithSubtest"} | ||
{"Action":"output","Test":"TestOutputWithSubtest","Output":"=== RUN TestOutputWithSubtest\n"} | ||
{"Action":"run","Test":"TestOutputWithSubtest/sub_test"} | ||
{"Action":"output","Test":"TestOutputWithSubtest/sub_test","Output":"=== RUN TestOutputWithSubtest/sub_test\n"} | ||
{"Action":"output","Test":"TestOutputWithSubtest","Output":"--- FAIL: TestOutputWithSubtest (0.00s)\n"} | ||
{"Action":"output","Test":"TestOutputWithSubtest","Output":" foo_test.go:6: output before sub tests\n"} | ||
{"Action":"output","Test":"TestOutputWithSubtest/sub_test","Output":" --- PASS: TestOutputWithSubtest/sub_test (0.00s)\n"} | ||
{"Action":"output","Test":"TestOutputWithSubtest/sub_test","Output":" foo_test.go:9: output from sub test\n"} | ||
{"Action":"output","Test":"TestOutputWithSubtest","Output":" foo_test.go:12: output after sub test\n"} | ||
{"Action":"pass","Test":"TestOutputWithSubtest/sub_test"} | ||
{"Action":"fail","Test":"TestOutputWithSubtest"} | ||
{"Action":"output","Output":"FAIL\n"} | ||
{"Action":"output","Output":"FAIL gotest.tools/gotestsum/foo 0.001s\n"} | ||
{"Action":"output","Output":"FAIL\n"} | ||
{"Action":"fail"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
=== RUN TestOutputWithSubtest | ||
=== RUN TestOutputWithSubtest/sub_test | ||
--- FAIL: TestOutputWithSubtest (0.00s) | ||
foo_test.go:6: output before sub tests | ||
--- PASS: TestOutputWithSubtest/sub_test (0.00s) | ||
foo_test.go:9: output from sub test | ||
foo_test.go:12: output after sub test | ||
FAIL | ||
FAIL gotest.tools/gotestsum/foo 0.001s | ||
FAIL |