You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
396 B
Go
25 lines
396 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestParseDuration(t *testing.T) {
|
|
d := parseDuration(" 45s")
|
|
if d != (45 * time.Second) {
|
|
t.Log(d)
|
|
t.Fail()
|
|
}
|
|
d = parseDuration(" 10m 45s")
|
|
if d != (45*time.Second)+(10*time.Minute) {
|
|
t.Log(d)
|
|
t.Fail()
|
|
}
|
|
d = parseDuration(" 12h 10m 45s")
|
|
if d != (12*time.Hour)+(45*time.Second)+(10*time.Minute) {
|
|
t.Log(d)
|
|
t.Fail()
|
|
}
|
|
}
|