mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-06 14:02:52 -05:00
Deprecated Time field, use a time.Duration instead.
The parser.Package.Time and parser.Test.Time fields are currently still supported, but will be removed in the future.
This commit is contained in:
26
parser/parser_test.go
Normal file
26
parser/parser_test.go
Normal file
@ -0,0 +1,26 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestParseSeconds(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
d time.Duration
|
||||
}{
|
||||
{"", 0},
|
||||
{"4", 4 * time.Second},
|
||||
{"0.1", 100 * time.Millisecond},
|
||||
{"0.050", 50 * time.Millisecond},
|
||||
{"2.003", 2*time.Second + 3*time.Millisecond},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
d := parseSeconds(test.in)
|
||||
if d != test.d {
|
||||
t.Errorf("parseSeconds(%q) == %v, want %v\n", test.in, d, test.d)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user