diff options
author | Eduardo Julian | 2017-02-25 19:57:30 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-02-25 19:57:30 -0400 |
commit | cbeafbafc0ab02d8c8335ccc106a90545d562985 (patch) | |
tree | 6af4fca5a18f5c85c4d9f097ee0cf37ac5629fc8 /stdlib | |
parent | 8ff8934813562f28f79cc08014947eb282256e6a (diff) |
- Exiting the program and getting the current time (in milliseconds) is now done through procedures.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/test.lux | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 82fcabed9..bab513cc4 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -17,12 +17,13 @@ [host #- try])) ## [Host] -(jvm-import java.lang.System - (#static exit [int] #io void) - (#static currentTimeMillis [] #io long)) +(def: now + (IO Int) + (io (_lux_proc ["io" "current-time"] []))) (do-template [<name> <signal>] - [(def: #hidden <name> (IO Unit) (System.exit <signal>))] + [(def: #hidden <name> (IO Bottom) + (io (_lux_proc ["io" "exit"] [<signal>])))] [exit 0] [die 1] @@ -51,9 +52,9 @@ [#let [test-runs (List/map (: (-> [Text (IO Test) Text] (Promise Nat)) (lambda [[module test description]] (do @ - [#let [pre (io;run (System.currentTimeMillis []))] + [#let [pre (io;run now)] outcome (io;run test) - #let [post (io;run (System.currentTimeMillis [])) + #let [post (io;run now) description+ (:: text;Codec<Text,Text> encode description)]] (case outcome (#;Left error) @@ -107,7 +108,7 @@ (def: #hidden (repeat ?seed times random-test) (-> (Maybe Nat) Nat (R;Random Test) Test) - (repeat' (default (int-to-nat (io;run (System.currentTimeMillis []))) + (repeat' (default (int-to-nat (io;run now)) ?seed) (case ?seed #;None times |