@@ -10,21 +10,24 @@ func TestItParsePositiveDurationsCorrectly(t *testing.T) {
1010 parser := after .New ()
1111
1212 valid := map [string ]time.Duration {
13- "1s" : time .Second ,
14- "+1 second" : time .Second ,
15- "20seconds" : time .Second * 20 ,
16- "1m" : time .Minute ,
17- "+1 minute" : time .Minute ,
18- "20 minutes" : time .Minute * 20 ,
19- "1h" : time .Hour ,
20- "+1 hour" : time .Hour ,
21- "20hours" : time .Hour * 20 ,
22- "1d" : time .Hour * 24 ,
23- "+1 day" : time .Hour * 24 ,
24- "20 days" : time .Hour * 24 * 20 ,
25- "1w" : time .Hour * 24 * 7 ,
26- "+1 week" : time .Hour * 24 * 7 ,
27- "20 weeks" : time .Hour * 24 * 7 * 20 ,
13+ "1 millisecond" : time .Millisecond ,
14+ "+1ms" : time .Millisecond ,
15+ "20 milliseconds" : time .Millisecond * 20 ,
16+ "1s" : time .Second ,
17+ "+1 second" : time .Second ,
18+ "20seconds" : time .Second * 20 ,
19+ "1m" : time .Minute ,
20+ "+1 minute" : time .Minute ,
21+ "20 minutes" : time .Minute * 20 ,
22+ "1h" : time .Hour ,
23+ "+1 hour" : time .Hour ,
24+ "20hours" : time .Hour * 20 ,
25+ "1d" : time .Hour * 24 ,
26+ "+1 day" : time .Hour * 24 ,
27+ "20 days" : time .Hour * 24 * 20 ,
28+ "1w" : time .Hour * 24 * 7 ,
29+ "+1 week" : time .Hour * 24 * 7 ,
30+ "20 weeks" : time .Hour * 24 * 7 * 20 ,
2831 }
2932
3033 for input , expected := range valid {
@@ -43,21 +46,24 @@ func TestItParseNegativeDurationsCorrectly(t *testing.T) {
4346 parser := after .New ()
4447
4548 valid := map [string ]time.Duration {
46- "-1s" : - time .Second ,
47- "-1 second" : - time .Second ,
48- "-20seconds" : - time .Second * 20 ,
49- "-1m" : - time .Minute ,
50- "-1 minute" : - time .Minute ,
51- "-20 minutes" : - time .Minute * 20 ,
52- "-1h" : - time .Hour ,
53- "-1 hour" : - time .Hour ,
54- "-20hours" : - time .Hour * 20 ,
55- "-1d" : - time .Hour * 24 ,
56- "-1 day" : - time .Hour * 24 ,
57- "-20 days" : - time .Hour * 24 * 20 ,
58- "-1w" : - time .Hour * 24 * 7 ,
59- "-1 week" : - time .Hour * 24 * 7 ,
60- "-20 weeks" : - time .Hour * 24 * 7 * 20 ,
49+ "-1ms" : - time .Millisecond ,
50+ "-1 millisecond" : - time .Millisecond ,
51+ "-20millisecond" : - time .Millisecond * 20 ,
52+ "-1s" : - time .Second ,
53+ "-1 second" : - time .Second ,
54+ "-20seconds" : - time .Second * 20 ,
55+ "-1m" : - time .Minute ,
56+ "-1 minute" : - time .Minute ,
57+ "-20 minutes" : - time .Minute * 20 ,
58+ "-1h" : - time .Hour ,
59+ "-1 hour" : - time .Hour ,
60+ "-20hours" : - time .Hour * 20 ,
61+ "-1d" : - time .Hour * 24 ,
62+ "-1 day" : - time .Hour * 24 ,
63+ "-20 days" : - time .Hour * 24 * 20 ,
64+ "-1w" : - time .Hour * 24 * 7 ,
65+ "-1 week" : - time .Hour * 24 * 7 ,
66+ "-20 weeks" : - time .Hour * 24 * 7 * 20 ,
6167 }
6268
6369 for input , expected := range valid {
0 commit comments