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.
bathyscaphe/internal/duration/duration_test.go

25 lines
369 B
Go

package duration
import (
"testing"
"time"
)
func TestParseDuration(t *testing.T) {
if ParseDuration("") != -1 {
t.Fail()
}
if ParseDuration("50s") != time.Second*50 {
t.Fail()
}
if ParseDuration("50m") != time.Minute*50 {
t.Fail()
}
if ParseDuration("50h") != time.Hour*50 {
t.Fail()
}
if ParseDuration("50d") != time.Hour*24*50 {
t.Fail()
}
}