# HG changeset patch # User Kim Alvefur # Date 1689528365 -7200 # Node ID 313c49c7566aeadd49f8a52c9e79cf0c1f80310e # Parent 6beec4de8e63397ed3cf208b4b1e3d17d78b4ce7 util.human.io: Add tests for parse_duration() (some failing) diff -r 6beec4de8e63 -r 313c49c7566a 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);