aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-07-16 19:26:05 +0200
committerKim Alvefur <zash@zash.se>2023-07-16 19:26:05 +0200
commit3ab3f3e1e7a70c9e466e1715a33d2c7a0ed08b1a (patch)
tree1f44ddf5f0b919a7bee2da5701d3f0018f40293b /spec
parent9f96301ce8d025cfbd15ab42caae7fc3906ba2d4 (diff)
downloadprosody-3ab3f3e1e7a70c9e466e1715a33d2c7a0ed08b1a.tar.gz
prosody-3ab3f3e1e7a70c9e466e1715a33d2c7a0ed08b1a.zip
util.human.io: Add tests for parse_duration() (some failing)
Diffstat (limited to 'spec')
-rw-r--r--spec/util_human_io_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_human_io_spec.lua b/spec/util_human_io_spec.lua
index 19acc9ac..be850a96 100644
--- a/spec/util_human_io_spec.lua
+++ b/spec/util_human_io_spec.lua
@@ -54,10 +54,19 @@ describe("util.human.io", function ()
test(60, "1 min");
test(60, "1 minute");
test(120, "2min");
+ test(7200, "2h");
+ test(7200, "2 hours");
test(86400, "1d");
+ test(604800, "1w");
+ test(604800, "1week");
+ test(1814400, "3 weeks");
test(2678400, "1m");
+ test(2678400, "1mo");
test(2678400, "1month");
test(2678400, "1 month");
+ test(31536000, "365 days");
+ test(31556952, "1 year");
+ return assert.is_nil(human_io.parse_duration("two weeks"), "\"2 weeks\" -> nil");
end);
end);
end);