From 3ab3f3e1e7a70c9e466e1715a33d2c7a0ed08b1a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 16 Jul 2023 19:26:05 +0200 Subject: util.human.io: Add tests for parse_duration() (some failing) --- spec/util_human_io_spec.lua | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- cgit v1.2.3