Commits

Miki Tebeka committed 71a65c8

0 time tests

Comments (0)

Files changed (5)

+2014-06-04 version 0.2.12
+    * Handle 0 time tests (github issue #16)
+
 2014-05-13 version 0.2.11
     * Add skipped to XML output (John Khvatov, github pull #15)
 
-# go2xunit 0.2.10
+# go2xunit 0.2.12
 
 Converts `go test -v` (or `gocheck -vv`) output to xunit compatible XML output
 (used in [Jenkins][jenkins]/[Hudson][hudson]).

data/gotest-0.out

+=== RUN ExampleA
+--- PASS: ExampleA (4.0003ms)
+=== RUN: ExampleOp
+--- PASS: ExampleOp (0)
+PASS
+ok      package 0.194s
 )
 
 const (
-	version = "0.2.11"
+	version = "0.2.12"
 
 	// gotest regular expressions
 
 	// --- PASS: TestSub (0.00 seconds)
 	// --- FAIL: TestSubFail (0.00 seconds)
 	// --- SKIP: TestSubSkip (0.00 seconds)
-	gt_endRE = "^--- (PASS|FAIL|SKIP): ([a-zA-Z_][^[:space:]]*) \\((\\d+.\\d+)"
+	gt_endRE = "^--- (PASS|FAIL|SKIP): ([a-zA-Z_][^[:space:]]*) \\((\\d+(.\\d+)?)"
 
 	// FAIL	_/home/miki/Projects/goroot/src/xunit	0.004s
 	// ok  	_/home/miki/Projects/goroot/src/anotherTest	0.000s
 		t.Fatalf("didn't parse name with number")
 	}
 }
+
+func Test_0Time(t *testing.T) {
+	suites, err := loadGotest("data/gotest-0.out", t)
+	if err != nil {
+		t.Fatalf("didn't parse name with number")
+	}
+
+	if len(suites) != 1 {
+		t.Fatalf("bad number of suites - %d", len(suites))
+	}
+
+	suite := suites[0]
+	if suite.Count() != 2 {
+		t.Fatalf("bad number of tests. expected %d got %d", 2, len(suite.Tests))
+	}
+	if suite.NumFailed() != 0 {
+		t.Fatalf("unexpected failure")
+	}
+}