diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/test.lux | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index f37c0a3c9..304846eec 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -41,7 +41,7 @@ [world ["." program]]]]) -(type: #export Tally +(type: .public Tally {#successes Nat #failures Nat #expected_coverage (Set Name) @@ -72,16 +72,16 @@ [failure_tally #failures] ) -(type: #export Assertion +(type: .public Assertion (Async [Tally Text])) -(type: #export Test +(type: .public Test (Random Assertion)) (def: separator text.new_line) -(def: #export (and' left right) +(def: .public (and' left right) {#.doc "Sequencing combinator."} (-> Assertion Assertion Assertion) (let [[read! write!] (: [(Async [Tally Text]) @@ -96,7 +96,7 @@ io.run)] read!)) -(def: #export (and left right) +(def: .public (and left right) {#.doc "Sequencing combinator."} (-> Test Test Test) (do {! random.monad} @@ -106,7 +106,7 @@ (def: context_prefix text.tab) -(def: #export (context description) +(def: .public (context description) (-> Text Test Test) (random\map (async\map (function (_ [tally documentation]) [tally (|> documentation @@ -118,14 +118,14 @@ (def: failure_prefix "[Failure] ") (def: success_prefix "[Success] ") -(def: #export failure +(def: .public failure (-> Text Test) (|>> (format ..failure_prefix) [..failure_tally] async\in random\in)) -(def: #export (assertion message condition) +(def: .public (assertion message condition) {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit Assertion) (<| async\in @@ -133,12 +133,12 @@ [..success_tally (format ..success_prefix message)] [..failure_tally (format ..failure_prefix message)]))) -(def: #export (test message condition) +(def: .public (test message condition) {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit Test) (random\in (..assertion message condition))) -(def: #export (lift message random) +(def: .public (lift message random) (-> Text (Random Bit) Test) (random\map (..assertion message) random)) @@ -146,11 +146,11 @@ Nat (hex "FEDCBA9876543210")) -(type: #export Seed +(type: .public Seed {#.doc "The seed value used for random testing (if that feature is used)."} Nat) -(def: #export (seed value test) +(def: .public (seed value test) (-> Seed Test Test) (function (_ prng) (let [[_ result] (random.run (random.pcg_32 [..pcg_32_magic_inc value]) @@ -166,9 +166,9 @@ (format documentation ..separator ..separator "Failed with this seed: " (%.nat seed))) -(exception: #export must_try_test_at_least_once) +(exception: .public must_try_test_at_least_once) -(def: #export (times amount test) +(def: .public (times amount test) (-> Nat Test Test) (case amount 0 (..failure (exception.error ..must_try_test_at_least_once [])) @@ -240,7 +240,7 @@ (def: failure_exit_code +1) (def: success_exit_code +0) -(def: #export (run! test) +(def: .public (run! test) (-> Test (Async Nothing)) (do async.monad [pre (async.future instant.now) @@ -318,7 +318,7 @@ (set.add [module remaining] output)))) (template [<macro> <function>] - [(syntax: #export (<macro> {coverage (<code>.tuple (<>.many <code>.any))} + [(syntax: .public (<macro> {coverage (<code>.tuple (<>.many <code>.any))} condition) (let [coverage (list\map (function (_ definition) (` ((~! ..reference) (~ definition)))) @@ -332,7 +332,7 @@ [cover ..|cover|] ) -(syntax: #export (for {coverage (<code>.tuple (<>.many <code>.any))} +(syntax: .public (for {coverage (<code>.tuple (<>.many <code>.any))} test) (let [coverage (list\map (function (_ definition) (` ((~! ..reference) (~ definition)))) @@ -350,7 +350,7 @@ [(update@ #expected_coverage (set.union coverage) tally) documentation])))))) -(syntax: #export (covering {module <code>.identifier} +(syntax: .public (covering {module <code>.identifier} test) (do meta.monad [.let [module (name.module module)] @@ -367,11 +367,11 @@ (~ (code.text coverage)) (~ test))))))) -(exception: #export (error_during_execution {error Text}) +(exception: .public (error_during_execution {error Text}) (exception.report ["Error" (%.text error)])) -(def: #export (in_parallel tests) +(def: .public (in_parallel tests) (-> (List Test) Test) (case (list.size tests) 0 |