add test for compiled test

This commit is contained in:
Tachikoma 2014-12-22 21:53:24 +08:00 committed by Joël Stemmer
parent 27383b3a74
commit 4f0ad507d0
3 changed files with 43 additions and 1 deletions

View File

@ -15,6 +15,7 @@ type TestCase struct {
reportName string
report *Report
noXmlHeader bool
packageName string
}
var testCases []TestCase = []TestCase{
@ -156,6 +157,34 @@ var testCases []TestCase = []TestCase{
},
noXmlHeader: true,
},
{
name: "07-compiled_test.txt",
reportName: "07-report.xml",
report: &Report{
Packages: []Package{
{
Name: "test/package",
Time: 160,
Tests: []Test{
{
Name: "TestOne",
Time: 60,
Result: PASS,
Output: []string{},
},
{
Name: "TestTwo",
Time: 100,
Result: PASS,
Output: []string{},
},
},
},
},
},
packageName: "test/package",
},
}
func TestParser(t *testing.T) {
@ -165,7 +194,7 @@ func TestParser(t *testing.T) {
t.Fatal(err)
}
report, err := Parse(file)
report, err := Parse(file, testCase.packageName)
if err != nil {
t.Fatalf("error parsing: %s", err)
}

View File

@ -0,0 +1,5 @@
=== RUN TestOne
--- PASS: TestOne (0.06s)
=== RUN TestTwo
--- PASS: TestTwo (0.10s)
PASS

8
tests/07-report.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="2" failures="0" time="0.160" name="test/package">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="package" name="TestOne" time="0.060"></testcase>
<testcase classname="package" name="TestTwo" time="0.100"></testcase>
</testsuite>