From 65d0beab4cb53a9ba8574e1133d105420f0b23aa Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 13 May 2020 19:30:47 -0400 Subject: Made test-running parallel again. --- stdlib/source/lux/test.lux | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'stdlib/source/lux/test.lux') 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))]))))) -- cgit v1.2.3