util.human.io: Add tests for parse_duration() (some failing)
authorKim Alvefur <zash@zash.se>
Sun, 16 Jul 2023 19:26:05 +0200
changeset 13202 313c49c7566a
parent 13201 6beec4de8e63
child 13203 278920294dfe
util.human.io: Add tests for parse_duration() (some failing)
spec/util_human_io_spec.lua
--- a/spec/util_human_io_spec.lua	Sun Jul 16 19:17:06 2023 +0200
+++ b/spec/util_human_io_spec.lua	Sun Jul 16 19:26:05 2023 +0200
@@ -54,10 +54,19 @@
 			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);