parser/gotest: Handle build errors in test packages with _test suffix

It's possible for test files to declare a package with the "_test"
suffix. If these packages contain build errors, they were not correctly
matched to the package without the "_test" suffix.

Refs #145
This commit is contained in:
Joël Stemmer
2022-09-17 01:05:30 +01:00
parent 81e5aaaaf1
commit 97e0285183
4 changed files with 36 additions and 1 deletions

11
testdata/038-report.xml vendored Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" errors="1">
<testsuite name="package/testpkg/pkg" tests="1" failures="0" errors="1" id="0" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="[build failed]" classname="package/testpkg/pkg_test" time="0.000">
<error message="Build error"><![CDATA[pkg/pkg_test.go:5:2: imported and not used: "fmt"]]></error>
</testcase>
</testsuite>
</testsuites>

4
testdata/038-test-pkg-name.txt vendored Normal file
View File

@ -0,0 +1,4 @@
# package/testpkg/pkg_test [package/testpkg/pkg.test]
pkg/pkg_test.go:5:2: imported and not used: "fmt"
FAIL package/testpkg/pkg [build failed]
FAIL