Skip to content

Commit 1a5ae0a

Browse files
committed
add clarifying tests
1 parent 5768cbc commit 1a5ae0a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

configtype/time_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func TestTime(t *testing.T) {
3434
{"now", now},
3535
{"2 days from now", now.AddDate(0, 0, 2)},
3636
{"5 months ago", now.AddDate(0, -5, 0)},
37+
{"10 months 3 days 4h20m from now", now.AddDate(0, 10, 3).Add(4 * time.Hour).Add(20 * time.Minute)},
38+
{"10 months 3 days 4 hours 20 minutes from now", now.AddDate(0, 10, 3).Add(4 * time.Hour).Add(20 * time.Minute)},
3739
}
3840
for _, tc := range cases {
3941
var d configtype.Time
@@ -98,6 +100,11 @@ func TestTime_JSONSchema(t *testing.T) {
98100
Err: false,
99101
Spec: `"10 months 3 days 4h20m from now"`,
100102
},
103+
{
104+
Name: "complex relative duration human",
105+
Err: false,
106+
Spec: `"10 months 3 days 4 hours 20 minutes from now"`,
107+
},
101108
},
102109
func() []testCase {
103110
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))

0 commit comments

Comments
 (0)