diff options
author | Eduardo Julian | 2020-05-13 19:30:47 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-05-13 19:30:47 -0400 |
commit | 65d0beab4cb53a9ba8574e1133d105420f0b23aa (patch) | |
tree | a90cf3fed8cbadc0fe558efc859100a658c8f4d6 /stdlib/source/lux/test.lux | |
parent | 2ebb1cfc9d8705f9b5812d6d26788c8d3b70b5c8 (diff) |
Made test-running parallel again.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/test.lux | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 18f487ff4..96535b886 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -19,7 +19,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." functor)] + ["." list ("#@." functor fold)] ["." set (#+ Set)]]] [time ["." instant] @@ -308,3 +308,25 @@ (~ (code.text module)) (.list (~+ coverage)) (~ test))))))) + +(def: #export (in-parallel tests) + (-> (List Test) Test) + (do random.monad + [seed random.nat + #let [prng (random.pcg-32 [..pcg-32-magic-inc seed]) + run! (: (-> Test Assertion) + (function (_ test) + (|> test + (random.run prng) + product.right + io.io + promise.future + promise@join)))]] + (wrap (do promise.monad + [assertions (monad.seq @ (list@map run! tests))] + (wrap [(|> assertions + (list@map product.left) + (list@fold ..add-counters ..start)) + (|> assertions + (list@map product.right) + (text.join-with ..separator))]))))) |