2018-08-30 00:57:22 +03:00
|
|
|
/+ test-runner
|
2018-01-07 09:51:52 +03:00
|
|
|
/= all-tests
|
2018-08-30 00:57:22 +03:00
|
|
|
/^ (map path (list test-arm:test-runner))
|
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-11-14 03:43:39 +03:00
|
|
|
|%
|
2018-08-30 00:57:22 +03:00
|
|
|
++ main
|
|
|
|
|= [defer=? tests=(list test:test-runner)]
|
2017-12-31 10:23:54 +03:00
|
|
|
^- tang
|
2018-08-23 06:53:49 +03:00
|
|
|
::
|
|
|
|
%- zing
|
|
|
|
%+ turn tests
|
2018-08-30 00:57:22 +03:00
|
|
|
|= [=path test-func=test-func:test-runner]
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2018-03-08 01:26:34 +03:00
|
|
|
::
|
2018-08-30 00:57:22 +03:00
|
|
|
=/ test-results=tang (run-test path test-func)
|
2018-08-23 06:53:49 +03:00
|
|
|
:: 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-30 00:57:22 +03:00
|
|
|
|= [pax=path test=test-func:test-runner]
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2018-08-24 20:46:31 +03:00
|
|
|
=+ name=(spud pax)
|
2018-08-30 00:57:22 +03:00
|
|
|
=+ run=(mule test)
|
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
|
2018-08-24 20:46:31 +03:00
|
|
|
`tang`[[%leaf (weld "CRASHED " name)] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
2018-05-03 20:51:39 +03:00
|
|
|
%& ?: =(~ p.run)
|
2018-08-24 20:46:31 +03:00
|
|
|
[[%leaf (weld "OK " name)] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
:: Create a welded list of all failures indented.
|
|
|
|
%- flop
|
|
|
|
;: weld
|
2018-08-24 20:46:31 +03:00
|
|
|
`tang`[[%leaf (weld "FAILED " name)] ~]
|
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
|
2018-08-30 00:57:22 +03:00
|
|
|
|= [prefix=path tests=(list test:test-runner)]
|
2018-08-23 06:53:49 +03:00
|
|
|
^+ 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)
|
|
|
|
::
|
2018-08-30 00:57:22 +03:00
|
|
|
=/ filtered-tests=(list test:test-runner)
|
2018-08-23 06:53:49 +03:00
|
|
|
%+ filter-tests-by-prefix
|
|
|
|
prefix
|
2018-08-30 00:57:22 +03:00
|
|
|
(resolve-test-paths:test-runner all-tests)
|
2018-08-23 06:53:49 +03:00
|
|
|
::
|
2018-08-30 00:57:22 +03:00
|
|
|
(main defer filtered-tests)
|