diff options
author | Eduardo Julian | 2022-08-19 18:54:31 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-08-19 18:54:31 -0400 |
commit | c00d94fa5c9e6b3b8d25f49d0f2d341ff61fa35b (patch) | |
tree | 4670b0891f851fe5edeb26734e5d010b984f7a45 /stdlib/source/test/lux/world | |
parent | ff6914a0e3bd85b2ae49b5bee6028dff8a47568a (diff) |
Added support for time-zoned time.
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r-- | stdlib/source/test/lux/world/time.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/solar.lux | 61 |
2 files changed, 64 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux index 4ca58afca..68e6e478c 100644 --- a/stdlib/source/test/lux/world/time.lux +++ b/stdlib/source/test/lux/world/time.lux @@ -28,7 +28,8 @@ ["[1][0]" duration] ["[1][0]" instant] ["[1][0]" month] - ["[1][0]" year]] + ["[1][0]" year] + ["[1][0]" solar]] [\\library ["[0]" / (.only) ["[0]" duration]]]) @@ -155,4 +156,5 @@ /instant.test /month.test /year.test + /solar.test ))))) diff --git a/stdlib/source/test/lux/world/time/solar.lux b/stdlib/source/test/lux/world/time/solar.lux new file mode 100644 index 000000000..f1da38370 --- /dev/null +++ b/stdlib/source/test/lux/world/time/solar.lux @@ -0,0 +1,61 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" codec]]] + [control + ["[0]" try] + ["[0]" exception] + ["[0]" io]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat] + ["i" int]]] + [meta + ["@" target]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [// + ["[0]" duration] + ["[0]" instant]]]]) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Instant]) + (do random.monad + [_ (in [])]) + (all _.and + (_.for [/.Zone] + (_.coverage [/.local_zone] + (io.run! (do io.monad + [zone /.local_zone] + (in (for @.lua + ... Lua doesn't natively support getting the time-zone ID. + (text.empty? zone) + + ... else + (not (text.empty? zone)))))))) + (_.coverage [/.now /.zone] + (io.run! (do io.monad + [zone /.local_zone + it /.now] + (in (text#= zone (/.zone it)))))) + (_.coverage [/.format /.universal /.offset] + (io.run! (do io.monad + [zone /.local_zone + it /.now] + (in (text.starts_with? (instant.format (instant.after (/.offset it) (/.universal it))) + (/.format it)))))) + ))) |