Add support for cached tests

This commit is contained in:
Joël Stemmer 2018-04-21 14:20:26 +01:00
parent 6a7ce5ecd4
commit 6e1ccef4d8
4 changed files with 34 additions and 1 deletions

View File

@ -807,6 +807,26 @@ var testCases = []TestCase{
},
},
},
{
name: "21-cached.txt",
reportName: "21-report.xml",
report: &parser.Report{
Packages: []parser.Package{
{
Name: "package/one",
Time: 0,
Tests: []*parser.Test{
{
Name: "TestOne",
Time: 0,
Result: parser.PASS,
Output: []string{},
},
},
},
},
},
},
}
func TestParser(t *testing.T) {

View File

@ -42,7 +42,7 @@ type Test struct {
var (
regexStatus = regexp.MustCompile(`--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)`)
regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`)
regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`)
regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|\(cached\)|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`)
regexOutput = regexp.MustCompile(`( )*\t(.*)`)
regexSummary = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`)
)

4
testdata/21-cached.txt vendored Normal file
View File

@ -0,0 +1,4 @@
=== RUN TestOne
--- PASS: TestOne (0.00s)
PASS
ok package/one (cached)

9
testdata/21-report.xml vendored Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite tests="1" failures="0" time="0.000" name="package/one">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="one" name="TestOne" time="0.000"></testcase>
</testsuite>
</testsuites>