2017-11-27 02:41:49 +03:00
|
|
|
/+ new-hoon, tester
|
2018-01-07 09:51:52 +03:00
|
|
|
/= all-tests
|
2018-08-23 06:53:49 +03:00
|
|
|
/^ (map path (list test-arm:tester))
|
2018-01-07 09:51:52 +03:00
|
|
|
/: /===/tests
|
2018-08-23 06:53:49 +03:00
|
|
|
/* /test-gen/
|
2018-01-07 09:51:52 +03:00
|
|
|
::
|
2017-12-31 09:37:49 +03:00
|
|
|
=, new-hoon
|
2017-11-14 03:43:39 +03:00
|
|
|
|%
|
2017-12-31 09:37:49 +03:00
|
|
|
::
|
|
|
|
++ test-runner
|
2018-08-23 06:53:49 +03:00
|
|
|
|= [defer=? eny=@uvJ tests=(list test:tester)]
|
2017-12-31 10:23:54 +03:00
|
|
|
^- tang
|
2018-08-23 06:53:49 +03:00
|
|
|
::
|
|
|
|
%- zing
|
|
|
|
%+ turn tests
|
|
|
|
|= [=path test-func=test-func:tester]
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2018-03-08 01:26:34 +03:00
|
|
|
::
|
2018-08-23 06:53:49 +03:00
|
|
|
=/ test-results=tang (run-test path eny test-func)
|
|
|
|
:: if :defer is set, produce errors; otherwise print them and produce ~
|
|
|
|
::
|
|
|
|
?: defer
|
|
|
|
test-results
|
|
|
|
((slog (flop test-results)) ~)
|
2017-12-27 00:03:47 +03:00
|
|
|
::
|
2017-12-31 09:37:49 +03:00
|
|
|
++ run-test
|
2018-05-25 01:39:56 +03:00
|
|
|
:: executes an individual test.
|
2018-08-23 06:53:49 +03:00
|
|
|
|= [pax=path eny=@uvJ test=test-func:tester]
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2018-01-07 09:51:52 +03:00
|
|
|
=+ name=(spud (flop pax))
|
|
|
|
=+ run=(mule |.((test eny)))
|
2017-12-27 00:03:47 +03:00
|
|
|
?- -.run
|
2018-03-19 06:54:47 +03:00
|
|
|
%| :: the stack is already flopped for output?
|
2017-12-27 00:03:47 +03:00
|
|
|
;: weld
|
2018-04-18 00:14:43 +03:00
|
|
|
p.run
|
2017-12-31 09:37:49 +03:00
|
|
|
`tang`[[%leaf (weld name " CRASHED")] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
2018-05-03 20:51:39 +03:00
|
|
|
%& ?: =(~ p.run)
|
2017-12-31 09:37:49 +03:00
|
|
|
[[%leaf (weld name " OK")] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
:: Create a welded list of all failures indented.
|
|
|
|
%- flop
|
|
|
|
;: weld
|
2017-12-31 09:37:49 +03:00
|
|
|
`tang`[[%leaf (weld name " FAILED")] ~]
|
2018-04-18 00:14:43 +03:00
|
|
|
::TODO indent
|
|
|
|
:: %+ turn p:run
|
|
|
|
:: |= {i/tape}
|
|
|
|
:: ^- tank
|
|
|
|
:: [%leaf (weld " " i)]
|
|
|
|
p.run
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
|
|
|
==
|
2018-08-23 06:53:49 +03:00
|
|
|
:: +filter-tests-by-prefix
|
2017-12-31 10:23:54 +03:00
|
|
|
::
|
2018-08-23 06:53:49 +03:00
|
|
|
++ filter-tests-by-prefix
|
|
|
|
|= [prefix=path tests=(list test:tester)]
|
|
|
|
^+ tests
|
|
|
|
::
|
|
|
|
=/ prefix-length=@ud (lent prefix)
|
|
|
|
::
|
|
|
|
%+ skim tests
|
|
|
|
::
|
|
|
|
|= [=path *]
|
|
|
|
=(prefix (scag prefix-length path))
|
2017-09-25 08:44:45 +03:00
|
|
|
--
|
2017-12-27 00:03:47 +03:00
|
|
|
::
|
2017-09-25 08:44:45 +03:00
|
|
|
:- %say
|
2017-12-31 21:41:01 +03:00
|
|
|
|= $: [now=@da eny=@uvJ bec=beak]
|
2018-03-19 07:18:20 +03:00
|
|
|
[filter=$?(~ [pax=path ~])]
|
2018-03-08 02:46:27 +03:00
|
|
|
[defer=_& seed=?(~ @uvJ)]
|
2017-09-25 08:44:45 +03:00
|
|
|
==
|
2018-08-23 06:53:49 +03:00
|
|
|
:: start printing early if we're not deferring output
|
|
|
|
::
|
|
|
|
~? !defer %tests-compiled
|
2017-09-25 08:44:45 +03:00
|
|
|
:- %tang
|
2018-08-23 06:53:49 +03:00
|
|
|
:: use empty path prefix if unspecified
|
|
|
|
::
|
|
|
|
=/ prefix=path ?~(filter ~ pax.filter)
|
|
|
|
=/ entropy ?~(seed eny seed)
|
|
|
|
::
|
|
|
|
=/ filtered-tests=(list test:tester)
|
|
|
|
%+ filter-tests-by-prefix
|
|
|
|
prefix
|
|
|
|
(resolve-test-paths:tester all-tests)
|
|
|
|
::
|
|
|
|
(test-runner defer entropy filtered-tests)
|