Changeset

13198:313c49c7566a

util.human.io: Add tests for parse_duration() (some failing)
author Kim Alvefur <zash@zash.se>
date Sun, 16 Jul 2023 19:26:05 +0200
parents 13197:6beec4de8e63
children 13199:278920294dfe
files spec/util_human_io_spec.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);