summaryrefslogtreecommitdiffstats
path: root/time/time_test.go
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-08-13 13:17:47 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-08-13 13:18:45 -0400
commitc4b3abd12e75645fef7d7aa8a460972e761458fb (patch)
tree37839bc089474626cc4890b6a85119f4647ac7b9 /time/time_test.go
parent6751d139ff328fb9852b6df5e014c38389803206 (diff)
time: update `Duration`
Add handling for parsing days.
Diffstat (limited to 'time/time_test.go')
-rw-r--r--time/time_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/time/time_test.go b/time/time_test.go
index efb3078..3f0bb84 100644
--- a/time/time_test.go
+++ b/time/time_test.go
@@ -69,6 +69,26 @@ func TestDurationToSeconds(t *testing.T) {
t.Errorf("duration in seconds incorrect: %v", d)
return
}
+
+ d, err = Duration("P3DT45M")
+ if err != nil {
+ t.Errorf("failed: %v", err)
+ return
+ }
+ if d.Seconds() != 261900 {
+ t.Errorf("duration in seconds incorrect: %v", d)
+ return
+ }
+
+ d, err = Duration("P7DT18H")
+ if err != nil {
+ t.Errorf("failed: %v", err)
+ return
+ }
+ if d.Seconds() != 669600 {
+ t.Errorf("duration in seconds incorrect: %v", d)
+ return
+ }
}
func TestIsCurrent(t *testing.T) {