21 lines
280 B
Go
21 lines
280 B
Go
package time
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestDurationText(t *testing.T) {
|
|
var (
|
|
input = []byte("10s")
|
|
output = time.Second * 10
|
|
d Duration
|
|
)
|
|
if err := d.UnmarshalText(input); err != nil {
|
|
t.FailNow()
|
|
}
|
|
if int64(output) != int64(d) {
|
|
t.FailNow()
|
|
}
|
|
}
|