Regenerate testdata files

Many of the testdata files were generated a long time ago with very old
versions of Go. The Go test output has changed over time, and these test
inputs no longer reflect the current state. The intention is to fully
support the test output of the most recent Go versions.

This commit also includes the source used to generate the test output,
so the output can be more easily updated in the future.
This commit is contained in:
Joël Stemmer 2022-05-13 21:55:44 +01:00
parent df7394c77c
commit 4d05b2dc3f
41 changed files with 614 additions and 444 deletions

27
testdata/001-pass-fail-skip.txt vendored Normal file
View File

@ -0,0 +1,27 @@
=== RUN TestPass
--- PASS: TestPass (0.06s)
=== RUN TestPassLog
pass_test.go:9: log line
pass_test.go:10: log
multi
line
--- PASS: TestPassLog (0.10s)
PASS
ok package/pass 0.160s
=== RUN TestOne
fail_test.go:6: Error message
fail_test.go:7: Longer
error
message.
--- FAIL: TestOne (0.151s)
FAIL
FAIL package/fail 0.151s
=== RUN TestSkip
skip_test.go:6: skip message
--- SKIP: TestSkip (0.02s)
=== RUN TestSkipNow
skip_test.go:10: log message
--- SKIP: TestSkipNow (0.13s)
PASS
ok package/skip 0.150s
FAIL

View File

@ -1,6 +0,0 @@
=== RUN TestZ
--- PASS: TestZ (0.06 seconds)
=== RUN TestA
--- PASS: TestA (0.10 seconds)
PASS
ok package/name 0.160s

View File

@ -1,10 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="5" failures="1" skipped="2">
<testsuite name="package/pass" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestZ" classname="package/name" time="0.060"></testcase>
<testcase name="TestA" classname="package/name" time="0.100"></testcase>
<testcase name="TestPass" classname="package/pass" time="0.060"></testcase>
<testcase name="TestPassLog" classname="package/pass" time="0.100"></testcase>
</testsuite>
<testsuite name="package/fail" tests="1" failures="1" errors="0" hostname="hostname" time="0.151" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/fail" time="0.151">
<failure message="Failed"><![CDATA[ fail_test.go:6: Error message
fail_test.go:7: Longer
error
message.]]></failure>
</testcase>
</testsuite>
<testsuite name="package/skip" tests="2" failures="0" errors="0" hostname="hostname" skipped="2" time="0.150" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestSkip" classname="package/skip" time="0.020">
<skipped message="Skipped"><![CDATA[ skip_test.go:6: skip message]]></skipped>
</testcase>
<testcase name="TestSkipNow" classname="package/skip" time="0.130">
<skipped message="Skipped"><![CDATA[ skip_test.go:10: log message]]></skipped>
</testcase>
</testsuite>
</testsuites>

11
testdata/002-fail.txt vendored
View File

@ -1,11 +0,0 @@
=== RUN TestOne
--- FAIL: TestOne (0.02 seconds)
file_test.go:11: Error message
file_test.go:11: Longer
error
message.
=== RUN TestTwo
--- PASS: TestTwo (0.13 seconds)
FAIL
exit status 1
FAIL package/name 0.151s

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" failures="1">
<testsuite name="package/name" tests="2" failures="1" errors="0" hostname="hostname" time="0.151" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name" time="0.020">
<failure message="Failed"><![CDATA[ file_test.go:11: Error message
file_test.go:11: Longer
error
message.]]></failure>
</testcase>
<testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" skipped="1">
<testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" skipped="1" time="0.150" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name" time="0.020">
<skipped message="Skipped"><![CDATA[ file_test.go:11: Skip message]]></skipped>
</testcase>
<testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
</testsuite>
</testsuites>

View File

@ -1,7 +0,0 @@
=== RUN TestOne
--- SKIP: TestOne (0.02 seconds)
file_test.go:11: Skip message
=== RUN TestTwo
--- PASS: TestTwo (0.13 seconds)
PASS
ok package/name 0.150s

View File

@ -1,6 +0,0 @@
=== RUN TestOne
--- PASS: TestOne (0.06s)
=== RUN TestTwo
--- PASS: TestTwo (0.10s)
PASS
ok package/name 0.160s

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name" time="0.060"></testcase>
<testcase name="TestTwo" classname="package/name" time="0.100"></testcase>
</testsuite>
</testsuites>

10
testdata/005-no-xml-header.txt vendored Normal file
View File

@ -0,0 +1,10 @@
=== RUN TestPass
--- PASS: TestPass (0.06s)
=== RUN TestPassLog
pass_test.go:9: log line
pass_test.go:10: log
multi
line
--- PASS: TestPassLog (0.10s)
PASS
ok package/pass 0.160s

View File

@ -1,6 +0,0 @@
=== RUN TestOne
--- PASS: TestOne (0.06s)
=== RUN TestTwo
--- PASS: TestTwo (0.10s)
PASS
ok package/name 0.160s

View File

@ -1,9 +1,9 @@
<testsuites tests="2">
<testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<testsuite name="package/pass" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name" time="0.060"></testcase>
<testcase name="TestTwo" classname="package/name" time="0.100"></testcase>
<testcase name="TestPass" classname="package/pass" time="0.060"></testcase>
<testcase name="TestPassLog" classname="package/pass" time="0.100"></testcase>
</testsuite>
</testsuites>

View File

@ -1,17 +0,0 @@
=== RUN TestOne
--- PASS: TestOne (0.06 seconds)
=== RUN TestTwo
--- PASS: TestTwo (0.10 seconds)
PASS
ok package/name1 0.160s
=== RUN TestOne
--- FAIL: TestOne (0.02 seconds)
file_test.go:11: Error message
file_test.go:11: Longer
error
message.
=== RUN TestTwo
--- PASS: TestTwo (0.13 seconds)
FAIL
exit status 1
FAIL package/name2 0.151s

View File

@ -1,22 +0,0 @@
<testsuites tests="4" failures="1">
<testsuite name="package/name1" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name1" time="0.060"></testcase>
<testcase name="TestTwo" classname="package/name1" time="0.100"></testcase>
</testsuite>
<testsuite name="package/name2" tests="2" failures="1" errors="0" hostname="hostname" time="0.151" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name2" time="0.020">
<failure message="Failed"><![CDATA[ file_test.go:11: Error message
file_test.go:11: Longer
error
message.]]></failure>
</testcase>
<testcase name="TestTwo" classname="package/name2" time="0.130"></testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,10 +1,23 @@
=== RUN TestDoFoo
=== RUN TestDoFoo2
--- PASS: TestDoFoo (0.27s)
cov_test.go:10: DoFoo log 1
cov_test.go:10: DoFoo log 2
--- PASS: TestDoFoo2 (0.16s)
cov_test.go:21: DoFoo2 log 1
cov_test.go:21: DoFoo2 log 2
PASS
ok package/name 0.440s
=== RUN TestP1
=== PAUSE TestP1
=== RUN TestP2
=== PAUSE TestP2
=== RUN TestP3
=== PAUSE TestP3
=== CONT TestP1
pkg_test.go:10: t.Log(P1)
=== CONT TestP3
pkg_test.go:24: t.Log(P3)
=== CONT TestP2
pkg_test.go:17: t.Log(P2)
pkg_test.go:19: P2 error
--- FAIL: TestP2 (0.05s)
=== CONT TestP3
pkg_test.go:26: P3 error
--- FAIL: TestP3 (0.08s)
=== CONT TestP1
pkg_test.go:12: P1 error
--- FAIL: TestP1 (0.10s)
FAIL
exit status 1
FAIL package/parallel 0.102s

View File

@ -1,10 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" time="0.440" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="3" failures="3">
<testsuite name="package/parallel" tests="3" failures="3" errors="0" hostname="hostname" time="0.102" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestDoFoo" classname="package/name" time="0.270"></testcase>
<testcase name="TestDoFoo2" classname="package/name" time="0.160"></testcase>
<testcase name="TestP1" classname="package/parallel" time="0.100">
<failure message="Failed"><![CDATA[ pkg_test.go:10: t.Log(P1)
pkg_test.go:12: P1 error]]></failure>
</testcase>
<testcase name="TestP2" classname="package/parallel" time="0.050">
<failure message="Failed"><![CDATA[ pkg_test.go:17: t.Log(P2)
pkg_test.go:19: P2 error]]></failure>
</testcase>
<testcase name="TestP3" classname="package/parallel" time="0.080">
<failure message="Failed"><![CDATA[ pkg_test.go:24: t.Log(P3)
pkg_test.go:26: P3 error]]></failure>
</testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,44 +0,0 @@
=== RUN TestOne
=== RUN TestOne/Child
=== RUN TestOne/Child#01
=== RUN TestOne/Child=02
--- PASS: TestOne (0.01s)
--- PASS: TestOne/Child (0.02s)
--- PASS: TestOne/Child#01 (0.03s)
--- PASS: TestOne/Child=02 (0.04s)
=== RUN TestTwo
=== RUN TestTwo/Child
=== RUN TestTwo/Child#01
=== RUN TestTwo/Child=02
--- PASS: TestTwo (0.01s)
--- PASS: TestTwo/Child (0.02s)
--- PASS: TestTwo/Child#01 (0.03s)
--- PASS: TestTwo/Child=02 (0.04s)
=== RUN TestThree
=== RUN TestThree/a#1
=== RUN TestThree/a#1/b#1
=== RUN TestThree/a#1/b#1/c#1
--- PASS: TestThree (0.01s)
--- PASS: TestThree/a#1 (0.02s)
--- PASS: TestThree/a#1/b#1 (0.03s)
--- PASS: TestThree/a#1/b#1/c#1 (0.04s)
=== RUN TestFour
=== RUN TestFour/#00
=== RUN TestFour/#01
=== RUN TestFour/#02
--- FAIL: TestFour (0.02s)
--- FAIL: TestFour/#00 (0.00s)
example.go:12: Expected abc OBTAINED:
xyz
example.go:123: Expected and obtained are different.
--- SKIP: TestFour/#01 (0.00s)
example.go:1234: Not supported yet.
--- PASS: TestFour/#02 (0.00s)
=== RUN TestFive
--- SKIP: TestFive (0.00s)
example.go:1392: Not supported yet.
=== RUN TestSix
--- FAIL: TestSix (0.00s)
example.go:371: This should not fail!
FAIL
FAIL package/name 0.050s

View File

@ -1,38 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="18" failures="3" skipped="2">
<testsuite name="package/name" tests="18" failures="3" errors="0" hostname="hostname" skipped="2" time="0.050" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="11" failures="4" skipped="1">
<testsuite name="package/subtests" tests="11" failures="4" errors="0" hostname="hostname" skipped="1" time="0.001" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestOne" classname="package/name" time="0.010"></testcase>
<testcase name="TestOne/Child" classname="package/name" time="0.020"></testcase>
<testcase name="TestOne/Child#01" classname="package/name" time="0.030"></testcase>
<testcase name="TestOne/Child=02" classname="package/name" time="0.040"></testcase>
<testcase name="TestTwo" classname="package/name" time="0.010"></testcase>
<testcase name="TestTwo/Child" classname="package/name" time="0.020"></testcase>
<testcase name="TestTwo/Child#01" classname="package/name" time="0.030"></testcase>
<testcase name="TestTwo/Child=02" classname="package/name" time="0.040"></testcase>
<testcase name="TestThree" classname="package/name" time="0.010"></testcase>
<testcase name="TestThree/a#1" classname="package/name" time="0.020"></testcase>
<testcase name="TestThree/a#1/b#1" classname="package/name" time="0.030"></testcase>
<testcase name="TestThree/a#1/b#1/c#1" classname="package/name" time="0.040"></testcase>
<testcase name="TestFour" classname="package/name" time="0.020">
<testcase name="TestSubtests" classname="package/subtests" time="0.000">
<failure message="Failed"></failure>
</testcase>
<testcase name="TestFour/#00" classname="package/name" time="0.000">
<failure message="Failed"><![CDATA[ example.go:12: Expected abc OBTAINED:
xyz
example.go:123: Expected and obtained are different.]]></failure>
<testcase name="TestSubtests/Subtest" classname="package/subtests" time="0.000"></testcase>
<testcase name="TestSubtests/Subtest#01" classname="package/subtests" time="0.000">
<failure message="Failed"><![CDATA[ subtests_test.go:10: error message]]></failure>
</testcase>
<testcase name="TestFour/#01" classname="package/name" time="0.000">
<skipped message="Skipped"><![CDATA[ example.go:1234: Not supported yet.]]></skipped>
<testcase name="TestSubtests/Subtest#02" classname="package/subtests" time="0.000">
<skipped message="Skipped"><![CDATA[ subtests_test.go:13: skip message]]></skipped>
</testcase>
<testcase name="TestFour/#02" classname="package/name" time="0.000"></testcase>
<testcase name="TestFive" classname="package/name" time="0.000">
<skipped message="Skipped"><![CDATA[ example.go:1392: Not supported yet.]]></skipped>
<testcase name="TestNestedSubtests" classname="package/subtests" time="0.000"></testcase>
<testcase name="TestNestedSubtests/a#1" classname="package/subtests" time="0.000"></testcase>
<testcase name="TestNestedSubtests/a#1/b#1" classname="package/subtests" time="0.000"></testcase>
<testcase name="TestNestedSubtests/a#1/b#1/c#1" classname="package/subtests" time="0.000"></testcase>
<testcase name="TestFailingSubtestWithNestedSubtest" classname="package/subtests" time="0.000">
<failure message="Failed"></failure>
</testcase>
<testcase name="TestSix" classname="package/name" time="0.000">
<failure message="Failed"><![CDATA[ example.go:371: This should not fail!]]></failure>
<testcase name="TestFailingSubtestWithNestedSubtest/Subtest" classname="package/subtests" time="0.000">
<failure message="Failed"><![CDATA[ subtests_test.go:31: Subtest error message]]></failure>
</testcase>
<testcase name="TestFailingSubtestWithNestedSubtest/Subtest/Subsubtest" classname="package/subtests" time="0.000"></testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

31
testdata/012-subtests.txt vendored Normal file
View File

@ -0,0 +1,31 @@
=== RUN TestSubtests
=== RUN TestSubtests/Subtest
subtests_test.go:7: ok
=== RUN TestSubtests/Subtest#01
subtests_test.go:10: error message
=== RUN TestSubtests/Subtest#02
subtests_test.go:13: skip message
--- FAIL: TestSubtests (0.00s)
--- PASS: TestSubtests/Subtest (0.00s)
--- FAIL: TestSubtests/Subtest#01 (0.00s)
--- SKIP: TestSubtests/Subtest#02 (0.00s)
=== RUN TestNestedSubtests
=== RUN TestNestedSubtests/a#1
=== RUN TestNestedSubtests/a#1/b#1
=== RUN TestNestedSubtests/a#1/b#1/c#1
--- PASS: TestNestedSubtests (0.00s)
--- PASS: TestNestedSubtests/a#1 (0.00s)
--- PASS: TestNestedSubtests/a#1/b#1 (0.00s)
--- PASS: TestNestedSubtests/a#1/b#1/c#1 (0.00s)
=== RUN TestFailingSubtestWithNestedSubtest
=== RUN TestFailingSubtestWithNestedSubtest/Subtest
=== RUN TestFailingSubtestWithNestedSubtest/Subtest/Subsubtest
subtests_test.go:29: ok
=== CONT TestFailingSubtestWithNestedSubtest/Subtest
subtests_test.go:31: Subtest error message
--- FAIL: TestFailingSubtestWithNestedSubtest (0.00s)
--- FAIL: TestFailingSubtestWithNestedSubtest/Subtest (0.00s)
--- PASS: TestFailingSubtestWithNestedSubtest/Subtest/Subsubtest (0.00s)
FAIL
exit status 1
FAIL package/subtests 0.001s

51
testdata/017-race.txt vendored
View File

@ -1,40 +1,45 @@
=== RUN TestRace
test output
2 0xc4200153d0
race_test.go:13: x = 3
==================
WARNING: DATA RACE
Write at 0x00c4200153d0 by goroutine 7:
race_test.TestRace.func1()
race_test.go:13 +0x3b
Write at 0x00c000138168 by goroutine 8:
package/race.TestRace.func1()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:9 +0x39
Previous write at 0x00c4200153d0 by goroutine 6:
race_test.TestRace()
race_test.go:15 +0x136
Previous write at 0x00c000138168 by goroutine 7:
package/race.TestRace()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:12 +0x105
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/go-src/go1.18/src/testing/testing.go:1486 +0x47
Goroutine 8 (running) created at:
package/race.TestRace()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:8 +0xfb
testing.tRunner()
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/go-src/go1.18/src/testing/testing.go:1486 +0x47
Goroutine 7 (running) created at:
race_test.TestRace()
race_test.go:14 +0x125
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
Goroutine 6 (running) created at:
testing.(*T).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:697 +0x543
/go-src/go1.18/src/testing/testing.go:1486 +0x724
testing.runTests.func1()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:882 +0xaa
/go-src/go1.18/src/testing/testing.go:1839 +0x99
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.runTests()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:888 +0x4e0
/go-src/go1.18/src/testing/testing.go:1837 +0x7e4
testing.(*M).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:822 +0x1c3
/go-src/go1.18/src/testing/testing.go:1719 +0xa71
main.main()
_test/_testmain.go:52 +0x20f
_testmain.go:47 +0x2e4
==================
testing.go:1312: race detected during execution of test
--- FAIL: TestRace (0.00s)
testing.go:610: race detected during execution of test
=== CONT
testing.go:1312: race detected during execution of test
FAIL
exit status 1
FAIL race_test 0.015s
FAIL package/race 0.005s

View File

@ -1,46 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="1">
<testsuite name="race_test" tests="1" failures="1" errors="0" hostname="hostname" time="0.015" timestamp="2022-01-01T00:00:00Z">
<testsuite name="package/race" tests="1" failures="1" errors="0" hostname="hostname" time="0.005" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestRace" classname="race_test" time="0.000">
<failure message="Failed"><![CDATA[test output
2 0xc4200153d0
<testcase name="TestRace" classname="package/race" time="0.000">
<failure message="Failed"><![CDATA[ race_test.go:13: x = 3
==================
WARNING: DATA RACE
Write at 0x00c4200153d0 by goroutine 7:
race_test.TestRace.func1()
race_test.go:13 +0x3b
Write at 0x00c000138168 by goroutine 8:
package/race.TestRace.func1()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:9 +0x39
Previous write at 0x00c4200153d0 by goroutine 6:
race_test.TestRace()
race_test.go:15 +0x136
Previous write at 0x00c000138168 by goroutine 7:
package/race.TestRace()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:12 +0x105
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/go-src/go1.18/src/testing/testing.go:1486 +0x47
Goroutine 8 (running) created at:
package/race.TestRace()
/src/github.com/jstemmer/go-junit-report/testdata/src/race/race_test.go:8 +0xfb
testing.tRunner()
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/go-src/go1.18/src/testing/testing.go:1486 +0x47
Goroutine 7 (running) created at:
race_test.TestRace()
race_test.go:14 +0x125
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
Goroutine 6 (running) created at:
testing.(*T).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:697 +0x543
/go-src/go1.18/src/testing/testing.go:1486 +0x724
testing.runTests.func1()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:882 +0xaa
/go-src/go1.18/src/testing/testing.go:1839 +0x99
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
/go-src/go1.18/src/testing/testing.go:1439 +0x213
testing.runTests()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:888 +0x4e0
/go-src/go1.18/src/testing/testing.go:1837 +0x7e4
testing.(*M).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:822 +0x1c3
/go-src/go1.18/src/testing/testing.go:1719 +0xa71
main.main()
_test/_testmain.go:52 +0x20f
_testmain.go:47 +0x2e4
==================
testing.go:610: race detected during execution of test]]></failure>
testing.go:1312: race detected during execution of test]]></failure>
</testcase>
<system-out><![CDATA[exit status 1]]></system-out>
<system-out><![CDATA[ testing.go:1312: race detected during execution of test
exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,19 +0,0 @@
=== RUN FirstTest
Message from first
=== PAUSE FirstTest
=== RUN SecondTest
Message from second
=== PAUSE SecondTest
=== CONT FirstTest
Supplemental from first
=== RUN ThirdTest
Message from third
--- FAIL: ThirdTest (0.01s)
parallel_test.go:32: ThirdTest error
--- FAIL: FirstTest (2.00s)
parallel_test.go:14: FirstTest error
--- FAIL: SecondTest (1.00s)
parallel_test.go:23: SecondTest error
FAIL
exit status 1
FAIL pkg/parallel 3.010s

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="3">
<testsuite name="pkg/parallel" tests="3" failures="3" errors="0" hostname="hostname" time="3.010" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="FirstTest" classname="pkg/parallel" time="2.000">
<failure message="Failed"><![CDATA[Message from first
Supplemental from first
parallel_test.go:14: FirstTest error]]></failure>
</testcase>
<testcase name="SecondTest" classname="pkg/parallel" time="1.000">
<failure message="Failed"><![CDATA[Message from second
parallel_test.go:23: SecondTest error]]></failure>
</testcase>
<testcase name="ThirdTest" classname="pkg/parallel" time="0.010">
<failure message="Failed"><![CDATA[Message from third
parallel_test.go:32: ThirdTest error]]></failure>
</testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,15 +1,8 @@
=== RUN TestNew
=== RUN TestNew/no
=== RUN TestNew/normal
--- PASS: TestNew (0.00s)
--- PASS: TestNew/no (0.00s)
--- PASS: TestNew/normal (0.00s)
=== RUN TestWriteThis
--- PASS: TestWriteThis (0.00s)
goos: darwin
goos: linux
goarch: amd64
pkg: package3/baz
BenchmarkDeepMerge-8 500000 2611 ns/op 1110 B/op 16 allocs/op
BenchmarkNext-8 500000 100 ns/op 100 B/op 1 allocs/op
pkg: package/bench
cpu: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
BenchmarkOne-8 1000000000 0.2640 ns/op
BenchmarkTwo-8 39787592 33.10 ns/op
PASS
ok package3/baz 1.382s
ok package/bench 1.642s

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6">
<testsuite name="package3/baz" tests="6" failures="0" errors="0" hostname="hostname" time="1.382" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="2">
<testsuite name="package/bench" tests="2" failures="0" errors="0" hostname="hostname" time="1.642" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestNew" classname="package3/baz" time="0.000"></testcase>
<testcase name="TestNew/no" classname="package3/baz" time="0.000"></testcase>
<testcase name="TestNew/normal" classname="package3/baz" time="0.000"></testcase>
<testcase name="TestWriteThis" classname="package3/baz" time="0.000"></testcase>
<testcase name="BenchmarkDeepMerge" classname="package3/baz" time="1.305500000"></testcase>
<testcase name="BenchmarkNext" classname="package3/baz" time="0.050000000"></testcase>
<testcase name="BenchmarkOne" classname="package/bench" time="0.000000000"></testcase>
<testcase name="BenchmarkTwo" classname="package/bench" time="1.312990536"></testcase>
<system-out><![CDATA[goos: linux
goarch: amd64
pkg: package/bench
cpu: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz]]></system-out>
</testsuite>
</testsuites>

View File

@ -1,69 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="17" failures="9">
<testsuite name="package/name1" tests="17" failures="9" errors="0" hostname="hostname" time="4.567" timestamp="2022-01-01T00:00:00Z">
<testsuite name="package/stdout" tests="17" failures="9" errors="0" hostname="hostname" time="0.001" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestFailWithStdoutAndTestOutput" classname="package/name1" time="0.100">
<testcase name="TestFailWithStdoutAndTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[multi
line
stdout
single-line stdout
example_test.go:13: single-line error
example_test.go:14: multi
stdout_test.go:11: single-line error
stdout_test.go:12: multi
line
error]]></failure>
</testcase>
<testcase name="TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
<testcase name="TestFailWithStdoutAndNoTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[multi
line
stdout
single-line stdout]]></failure>
</testcase>
<testcase name="TestFailWithTestOutput" classname="package/name1" time="0.200">
<failure message="Failed"><![CDATA[ example_test.go:26: single-line error
example_test.go:27: multi
<testcase name="TestFailWithTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[ stdout_test.go:22: single-line error
stdout_test.go:23: multi
line
error]]></failure>
</testcase>
<testcase name="TestFailWithNoTestOutput" classname="package/name1" time="0.250">
<testcase name="TestFailWithNoTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"></failure>
</testcase>
<testcase name="TestPassWithStdoutAndTestOutput" classname="package/name1" time="0.300"></testcase>
<testcase name="TestPassWithStdoutAndNoTestOutput" classname="package/name1" time="0.350"></testcase>
<testcase name="TestPassWithTestOutput" classname="package/name1" time="0.400"></testcase>
<testcase name="TestPassWithNoTestOutput" classname="package/name1" time="0.500"></testcase>
<testcase name="TestSubtests" classname="package/name1" time="2.270">
<testcase name="TestPassWithStdoutAndTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestPassWithStdoutAndNoTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestPassWithTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestPassWithNoTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestSubtests" classname="package/stdout" time="0.000">
<failure message="Failed"></failure>
</testcase>
<testcase name="TestSubtests/TestFailWithStdoutAndTestOutput" classname="package/name1" time="0.100">
<failure message="Failed"><![CDATA[1 multi
<testcase name="TestSubtests/TestFailWithStdoutAndTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[multi
line
stdout
1 single-line stdout
example_test.go:65: 1 single-line error
example_test.go:66: 1 multi
single-line stdout
stdout_test.go:11: single-line error
stdout_test.go:12: multi
line
error]]></failure>
</testcase>
<testcase name="TestSubtests/TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
<failure message="Failed"><![CDATA[2 multi
<testcase name="TestSubtests/TestFailWithStdoutAndNoTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[multi
line
stdout
2 single-line stdout]]></failure>
single-line stdout]]></failure>
</testcase>
<testcase name="TestSubtests/TestFailWithTestOutput" classname="package/name1" time="0.200">
<failure message="Failed"><![CDATA[ example_test.go:78: 3 single-line error
example_test.go:79: 3 multi
<testcase name="TestSubtests/TestFailWithTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"><![CDATA[ stdout_test.go:22: single-line error
stdout_test.go:23: multi
line
error]]></failure>
</testcase>
<testcase name="TestSubtests/TestFailWithNoTestOutput" classname="package/name1" time="0.250">
<testcase name="TestSubtests/TestFailWithNoTestOutput" classname="package/stdout" time="0.000">
<failure message="Failed"></failure>
</testcase>
<testcase name="TestSubtests/TestPassWithStdoutAndTestOutput" classname="package/name1" time="0.300"></testcase>
<testcase name="TestSubtests/TestPassWithStdoutAndNoTestOutput" classname="package/name1" time="0.350"></testcase>
<testcase name="TestSubtests/TestPassWithTestOutput" classname="package/name1" time="0.400"></testcase>
<testcase name="TestSubtests/TestPassWithNoTestOutput" classname="package/name1" time="0.500"></testcase>
<testcase name="TestSubtests/TestPassWithStdoutAndTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestSubtests/TestPassWithStdoutAndNoTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestSubtests/TestPassWithTestOutput" classname="package/stdout" time="0.000"></testcase>
<testcase name="TestSubtests/TestPassWithNoTestOutput" classname="package/stdout" time="0.000"></testcase>
<system-out><![CDATA[exit status 1]]></system-out>
</testsuite>
</testsuites>

View File

@ -3,98 +3,99 @@ multi
line
stdout
single-line stdout
--- FAIL: TestFailWithStdoutAndTestOutput (0.10s)
example_test.go:13: single-line error
example_test.go:14: multi
stdout_test.go:11: single-line error
stdout_test.go:12: multi
line
error
--- FAIL: TestFailWithStdoutAndTestOutput (0.00s)
=== RUN TestFailWithStdoutAndNoTestOutput
multi
line
stdout
single-line stdout
--- FAIL: TestFailWithStdoutAndNoTestOutput (0.15s)
--- FAIL: TestFailWithStdoutAndNoTestOutput (0.00s)
=== RUN TestFailWithTestOutput
--- FAIL: TestFailWithTestOutput (0.20s)
example_test.go:26: single-line error
example_test.go:27: multi
stdout_test.go:22: single-line error
stdout_test.go:23: multi
line
error
--- FAIL: TestFailWithTestOutput (0.00s)
=== RUN TestFailWithNoTestOutput
--- FAIL: TestFailWithNoTestOutput (0.25s)
--- FAIL: TestFailWithNoTestOutput (0.00s)
=== RUN TestPassWithStdoutAndTestOutput
multi
line
stdout
single-line stdout
--- PASS: TestPassWithStdoutAndTestOutput (0.30s)
example_test.go:39: single-line info
example_test.go:40: multi
stdout_test.go:33: single-line info
stdout_test.go:34: multi
line
info
--- PASS: TestPassWithStdoutAndTestOutput (0.00s)
=== RUN TestPassWithStdoutAndNoTestOutput
multi
line
stdout
single-line stdout
--- PASS: TestPassWithStdoutAndNoTestOutput (0.35s)
--- PASS: TestPassWithStdoutAndNoTestOutput (0.00s)
=== RUN TestPassWithTestOutput
--- PASS: TestPassWithTestOutput (0.40s)
example_test.go:51: single-line info
example_test.go:52: multi
stdout_test.go:43: single-line info
stdout_test.go:44: multi
line
info
--- PASS: TestPassWithTestOutput (0.00s)
=== RUN TestPassWithNoTestOutput
--- PASS: TestPassWithNoTestOutput (0.50s)
--- PASS: TestPassWithNoTestOutput (0.00s)
=== RUN TestSubtests
=== RUN TestSubtests/TestFailWithStdoutAndTestOutput
1 multi
multi
line
stdout
1 single-line stdout
single-line stdout
stdout_test.go:11: single-line error
stdout_test.go:12: multi
line
error
=== RUN TestSubtests/TestFailWithStdoutAndNoTestOutput
2 multi
multi
line
stdout
2 single-line stdout
single-line stdout
=== RUN TestSubtests/TestFailWithTestOutput
stdout_test.go:22: single-line error
stdout_test.go:23: multi
line
error
=== RUN TestSubtests/TestFailWithNoTestOutput
=== RUN TestSubtests/TestPassWithStdoutAndTestOutput
4 multi
multi
line
stdout
4 single-line stdout
single-line stdout
stdout_test.go:33: single-line info
stdout_test.go:34: multi
line
info
=== RUN TestSubtests/TestPassWithStdoutAndNoTestOutput
5 multi
multi
line
stdout
5 single-line stdout
single-line stdout
=== RUN TestSubtests/TestPassWithTestOutput
stdout_test.go:43: single-line info
stdout_test.go:44: multi
line
info
=== RUN TestSubtests/TestPassWithNoTestOutput
--- FAIL: TestSubtests (2.27s)
--- FAIL: TestSubtests/TestFailWithStdoutAndTestOutput (0.10s)
example_test.go:65: 1 single-line error
example_test.go:66: 1 multi
line
error
--- FAIL: TestSubtests/TestFailWithStdoutAndNoTestOutput (0.15s)
--- FAIL: TestSubtests/TestFailWithTestOutput (0.20s)
example_test.go:78: 3 single-line error
example_test.go:79: 3 multi
line
error
--- FAIL: TestSubtests/TestFailWithNoTestOutput (0.25s)
--- PASS: TestSubtests/TestPassWithStdoutAndTestOutput (0.30s)
example_test.go:91: 4 single-line info
example_test.go:92: 4 multi
line
info
--- PASS: TestSubtests/TestPassWithStdoutAndNoTestOutput (0.35s)
--- PASS: TestSubtests/TestPassWithTestOutput (0.40s)
example_test.go:103: 6 single-line info
example_test.go:104: 6 multi
line
info
--- PASS: TestSubtests/TestPassWithNoTestOutput (0.50s)
--- FAIL: TestSubtests (0.00s)
--- FAIL: TestSubtests/TestFailWithStdoutAndTestOutput (0.00s)
--- FAIL: TestSubtests/TestFailWithStdoutAndNoTestOutput (0.00s)
--- FAIL: TestSubtests/TestFailWithTestOutput (0.00s)
--- FAIL: TestSubtests/TestFailWithNoTestOutput (0.00s)
--- PASS: TestSubtests/TestPassWithStdoutAndTestOutput (0.00s)
--- PASS: TestSubtests/TestPassWithStdoutAndNoTestOutput (0.00s)
--- PASS: TestSubtests/TestPassWithTestOutput (0.00s)
--- PASS: TestSubtests/TestPassWithNoTestOutput (0.00s)
FAIL
FAIL package/name1 4.567s
exit status 1
FAIL package/stdout 0.001s

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="9">
<testsuite name="github.com/jstemmer/test/whitespace" tests="9" failures="0" errors="0" hostname="hostname" time="0.001" timestamp="2022-01-01T00:00:00Z">
<testsuite name="package/whitespace" tests="9" failures="0" errors="0" hostname="hostname" time="0.001" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithSpace" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithTab" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithNewlinesFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithSpace" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithTab" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithNewlinesFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestFlat" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestWithSpace" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestWithTab" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestWithNewlinesFlat" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestFlat" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithSpace" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithTab" classname="package/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithNewlinesFlat" classname="package/whitespace" time="0.000"></testcase>
</testsuite>
</testsuites>

View File

@ -1,10 +1,16 @@
=== RUN TestFlat
whitespace_test.go:9: log 1
whitespace_test.go:10: log 2
printf 1
printf 2
--- PASS: TestFlat (0.00s)
whitespace_test.go:9: log 1
whitespace_test.go:10: log 2
=== RUN TestWithSpace
whitespace_test.go:16: no-space
whitespace_test.go:17: one-space
whitespace_test.go:18: two-space
whitespace_test.go:19: four-space
whitespace_test.go:20: eight-space
whitespace_test.go:21: no-space
no-space
one-space
two-space
@ -12,21 +18,21 @@ no-space
eight-space
no-space
--- PASS: TestWithSpace (0.00s)
whitespace_test.go:16: no-space
whitespace_test.go:17: one-space
whitespace_test.go:18: two-space
whitespace_test.go:19: four-space
whitespace_test.go:20: eight-space
whitespace_test.go:21: no-space
=== RUN TestWithTab
whitespace_test.go:31: no-tab
whitespace_test.go:32: one-tab
whitespace_test.go:33: two-tab
no-tab
one-tab
two-tab
--- PASS: TestWithTab (0.00s)
whitespace_test.go:31: no-tab
whitespace_test.go:32: one-tab
whitespace_test.go:33: two-tab
=== RUN TestWithNewlinesFlat
whitespace_test.go:40: no-newline
whitespace_test.go:41: one-newline
one-newline
whitespace_test.go:42: two-newlines
two-newlines
two-newlines
no-newline
one-newline
one-newline
@ -34,17 +40,19 @@ two-newlines
two-newlines
two-newlines
--- PASS: TestWithNewlinesFlat (0.00s)
whitespace_test.go:40: no-newline
whitespace_test.go:41: one-newline
one-newline
whitespace_test.go:42: two-newlines
two-newlines
two-newlines
=== RUN TestSubTests
=== RUN TestSubTests/TestFlat
whitespace_test.go:9: log 1
whitespace_test.go:10: log 2
printf 1
printf 2
=== RUN TestSubTests/TestWithSpace
whitespace_test.go:16: no-space
whitespace_test.go:17: one-space
whitespace_test.go:18: two-space
whitespace_test.go:19: four-space
whitespace_test.go:20: eight-space
whitespace_test.go:21: no-space
no-space
one-space
two-space
@ -52,10 +60,19 @@ no-space
eight-space
no-space
=== RUN TestSubTests/TestWithTab
whitespace_test.go:31: no-tab
whitespace_test.go:32: one-tab
whitespace_test.go:33: two-tab
no-tab
one-tab
two-tab
=== RUN TestSubTests/TestWithNewlinesFlat
whitespace_test.go:40: no-newline
whitespace_test.go:41: one-newline
one-newline
whitespace_test.go:42: two-newlines
two-newlines
two-newlines
no-newline
one-newline
one-newline
@ -64,25 +81,8 @@ two-newlines
two-newlines
--- PASS: TestSubTests (0.00s)
--- PASS: TestSubTests/TestFlat (0.00s)
whitespace_test.go:9: log 1
whitespace_test.go:10: log 2
--- PASS: TestSubTests/TestWithSpace (0.00s)
whitespace_test.go:16: no-space
whitespace_test.go:17: one-space
whitespace_test.go:18: two-space
whitespace_test.go:19: four-space
whitespace_test.go:20: eight-space
whitespace_test.go:21: no-space
--- PASS: TestSubTests/TestWithTab (0.00s)
whitespace_test.go:31: no-tab
whitespace_test.go:32: one-tab
whitespace_test.go:33: two-tab
--- PASS: TestSubTests/TestWithNewlinesFlat (0.00s)
whitespace_test.go:40: no-newline
whitespace_test.go:41: one-newline
one-newline
whitespace_test.go:42: two-newlines
two-newlines
two-newlines
PASS
ok github.com/jstemmer/test/whitespace 0.001s
ok package/whitespace 0.001s

View File

@ -17,7 +17,7 @@ import (
var verbose bool
var configs = map[string]gojunitreport.Config{
"005-no_xml_header.txt": {SkipXMLHeader: true},
"005-no-xml-header.txt": {SkipXMLHeader: true},
"006-mixed.txt": {SkipXMLHeader: true},
"007-compiled_test.txt": {PackageName: "test/package"},
}

23
testdata/src/bench/bench_test.go vendored Normal file
View File

@ -0,0 +1,23 @@
package bench
import (
"strconv"
"testing"
)
func BenchmarkOne(b *testing.B) {
for i := 0; i < b.N; i++ {
test(i)
}
}
func BenchmarkTwo(b *testing.B) {
for i := 0; i < b.N; i++ {
n, _ := strconv.Atoi(strconv.Itoa(i))
test(n)
}
}
func test(x int) int {
return x + 1
}

8
testdata/src/fail/fail_test.go vendored Normal file
View File

@ -0,0 +1,8 @@
package fail
import "testing"
func TestOne(t *testing.T) {
t.Errorf("Error message")
t.Errorf("Longer\nerror\nmessage.")
}

3
testdata/src/go.mod vendored Normal file
View File

@ -0,0 +1,3 @@
module package
go 1.13

27
testdata/src/parallel/pkg_test.go vendored Normal file
View File

@ -0,0 +1,27 @@
package pkg
import (
"testing"
"time"
)
func TestP1(t *testing.T) {
t.Parallel()
t.Log("t.Log(P1)")
time.Sleep(100*time.Millisecond)
t.Errorf("P1 error")
}
func TestP2(t *testing.T) {
t.Parallel()
t.Log("t.Log(P2)")
time.Sleep(50*time.Millisecond)
t.Errorf("P2 error")
}
func TestP3(t *testing.T) {
t.Parallel()
t.Log("t.Log(P3)")
time.Sleep(75*time.Millisecond)
t.Errorf("P3 error")
}

14
testdata/src/pass/pass.go vendored Normal file
View File

@ -0,0 +1,14 @@
package pass
import "fmt"
func message() string {
return "line"
}
func unused(n int) string {
if n < 0 {
return "0"
}
return fmt.Sprintf("%d\n", n)
}

11
testdata/src/pass/pass_test.go vendored Normal file
View File

@ -0,0 +1,11 @@
package pass
import "testing"
func TestPass(t *testing.T) {
}
func TestPassLog(t *testing.T) {
t.Logf("log %s", message())
t.Log("log\nmulti\nline")
}

15
testdata/src/race/race_test.go vendored Normal file
View File

@ -0,0 +1,15 @@
package race
import "testing"
func TestRace(t *testing.T) {
done := make(chan bool)
x := 0
go func() {
x = 5
done <- true
}()
x = 3
t.Logf("x = %d\n", x)
<-done
}

12
testdata/src/skip/skip_test.go vendored Normal file
View File

@ -0,0 +1,12 @@
package skip
import "testing"
func TestSkip(t *testing.T) {
t.Skip("skip message")
}
func TestSkipNow(t *testing.T) {
t.Log("log message")
t.SkipNow()
}

59
testdata/src/stdout/stdout_test.go vendored Normal file
View File

@ -0,0 +1,59 @@
package stdout
import (
"fmt"
"testing"
)
func TestFailWithStdoutAndTestOutput(t *testing.T) {
fmt.Print("multi\nline\nstdout\n")
fmt.Print("single-line stdout\n")
t.Errorf("single-line error")
t.Errorf("multi\nline\nerror")
}
func TestFailWithStdoutAndNoTestOutput(t *testing.T) {
fmt.Print("multi\nline\nstdout\n")
fmt.Print("single-line stdout\n")
t.Fail()
}
func TestFailWithTestOutput(t *testing.T) {
t.Errorf("single-line error")
t.Errorf("multi\nline\nerror")
}
func TestFailWithNoTestOutput(t *testing.T) {
t.Fail()
}
func TestPassWithStdoutAndTestOutput(t *testing.T) {
fmt.Print("multi\nline\nstdout\n")
fmt.Print("single-line stdout\n")
t.Log("single-line info")
t.Log("multi\nline\ninfo")
}
func TestPassWithStdoutAndNoTestOutput(t *testing.T) {
fmt.Print("multi\nline\nstdout\n")
fmt.Print("single-line stdout\n")
}
func TestPassWithTestOutput(t *testing.T) {
t.Log("single-line info")
t.Log("multi\nline\ninfo")
}
func TestPassWithNoTestOutput(t *testing.T) {
}
func TestSubtests(t *testing.T) {
t.Run("TestFailWithStdoutAndTestOutput", TestFailWithStdoutAndTestOutput)
t.Run("TestFailWithStdoutAndNoTestOutput", TestFailWithStdoutAndNoTestOutput)
t.Run("TestFailWithTestOutput", TestFailWithTestOutput)
t.Run("TestFailWithNoTestOutput", TestFailWithNoTestOutput)
t.Run("TestPassWithStdoutAndTestOutput", TestPassWithStdoutAndTestOutput)
t.Run("TestPassWithStdoutAndNoTestOutput", TestPassWithStdoutAndNoTestOutput)
t.Run("TestPassWithTestOutput", TestPassWithTestOutput)
t.Run("TestPassWithNoTestOutput", TestPassWithNoTestOutput)
}

33
testdata/src/subtests/subtests_test.go vendored Normal file
View File

@ -0,0 +1,33 @@
package subtests
import "testing"
func TestSubtests(t *testing.T) {
t.Run("Subtest", func(t *testing.T) {
t.Log("ok")
})
t.Run("Subtest", func(t *testing.T) {
t.Error("error message")
})
t.Run("Subtest", func(t *testing.T) {
t.Skip("skip message")
})
}
func TestNestedSubtests(t *testing.T) {
t.Run("a#1", func(t *testing.T) {
t.Run("b#1", func(t *testing.T) {
t.Run("c#1", func(t *testing.T) {
})
})
})
}
func TestFailingSubtestWithNestedSubtest(t *testing.T) {
t.Run("Subtest", func(t *testing.T) {
t.Run("Subsubtest", func(t *testing.T) {
t.Log("ok")
})
t.Errorf("Subtest error message")
})
}

View File

@ -0,0 +1,53 @@
package main
import (
"fmt"
"testing"
)
func TestFlat(t *testing.T) {
t.Logf("log 1")
t.Logf("log 2")
fmt.Printf("printf 1\n")
fmt.Printf("printf 2\n")
}
func TestWithSpace(t *testing.T) {
t.Logf("no-space")
t.Logf(" one-space")
t.Logf(" two-space")
t.Logf(" four-space")
t.Logf(" eight-space")
t.Logf("no-space")
fmt.Printf("no-space\n")
fmt.Printf(" one-space\n")
fmt.Printf(" two-space\n")
fmt.Printf(" four-space\n")
fmt.Printf(" eight-space\n")
fmt.Printf("no-space\n")
}
func TestWithTab(t *testing.T) {
t.Logf("no-tab")
t.Logf("\tone-tab")
t.Logf("\t\ttwo-tab")
fmt.Printf("no-tab\n")
fmt.Printf("\tone-tab\n")
fmt.Printf("\t\ttwo-tab\n")
}
func TestWithNewlinesFlat(t *testing.T) {
t.Logf("no-newline")
t.Logf("one-newline\none-newline")
t.Logf("two-newlines\ntwo-newlines\ntwo-newlines")
fmt.Println("no-newline")
fmt.Println("one-newline\none-newline")
fmt.Println("two-newlines\ntwo-newlines\ntwo-newlines")
}
func TestSubTests(t *testing.T) {
t.Run("TestFlat", TestFlat)
t.Run("TestWithSpace", TestWithSpace)
t.Run("TestWithTab", TestWithTab)
t.Run("TestWithNewlinesFlat", TestWithNewlinesFlat)
}