aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Saxton <peterhsaxton@gmail.com>2020-06-12 14:07:34 +0100
committerLouis Pilfold <louis@lpil.uk>2020-06-16 10:21:40 +0100
commite229b0c4bd59736c99717559439416b1784442c2 (patch)
treed66fd08e773bf1f58eb1129264963e8c15489bfe /test
parentbd6715c6c2b1e5b4eab88f47c007fbab1d81ab22 (diff)
downloadgleam_stdlib-e229b0c4bd59736c99717559439416b1784442c2.tar.gz
gleam_stdlib-e229b0c4bd59736c99717559439416b1784442c2.zip
add a call to the os system time
Diffstat (limited to 'test')
-rw-r--r--test/gleam/os_test.gleam13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/gleam/os_test.gleam b/test/gleam/os_test.gleam
index f248d2b..8a0b5f1 100644
--- a/test/gleam/os_test.gleam
+++ b/test/gleam/os_test.gleam
@@ -1,5 +1,6 @@
import gleam/map
import gleam/os
+import gleam/io
import gleam/should
pub fn env_test() {
@@ -13,3 +14,15 @@ pub fn env_test() {
|> map.get("GLEAM_TEST")
|> should.equal(Error(Nil))
}
+
+pub fn system_time_test() {
+ let june_12_2020 = 1591966971
+ os.system_time(os.Second) > june_12_2020
+ |> should.equal(True)
+ os.system_time(os.Second) < june_12_2020 * 1000
+ |> should.equal(True)
+ os.system_time(os.Millisecond) > june_12_2020 * 1000
+ |> should.equal(True)
+ os.system_time(os.Millisecond) < june_12_2020 * 1000000
+ |> should.equal(True)
+}