2017-11-27 02:41:49 +03:00
|
|
|
/+ new-hoon, tester
|
2018-01-07 09:51:52 +03:00
|
|
|
/= all-tests
|
|
|
|
/^ (map @ta tests:tester)
|
|
|
|
/: /===/tests
|
|
|
|
/_ /test-tree/
|
|
|
|
::
|
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
|
2017-12-31 10:23:54 +03:00
|
|
|
:> run all tests in {a} with a filter.
|
2017-12-31 21:41:01 +03:00
|
|
|
=| pax=path
|
2018-01-07 09:51:52 +03:00
|
|
|
|= [filter=path eny=@uvJ a=tests:tester]
|
2017-12-31 10:23:54 +03:00
|
|
|
^- tang
|
2017-12-31 09:37:49 +03:00
|
|
|
%- concat:ls
|
2018-01-07 09:51:52 +03:00
|
|
|
%+ turn a
|
|
|
|
|= b=instance:tester
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2017-12-31 10:23:54 +03:00
|
|
|
=^ matches filter (match-filter filter p.b)
|
|
|
|
?. matches
|
|
|
|
~
|
2017-12-31 09:37:49 +03:00
|
|
|
?- -.q.b
|
2018-01-07 09:51:52 +03:00
|
|
|
%& (run-test [p.b pax] eny p.q.b)
|
2017-12-31 09:37:49 +03:00
|
|
|
%| ^$(pax [p.b pax], a p.q.b)
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
|
|
|
::
|
2017-12-31 09:37:49 +03:00
|
|
|
++ run-test
|
|
|
|
:> executes an individual test.
|
2018-01-07 09:51:52 +03:00
|
|
|
|= [pax=path eny=@uvJ test=$-(@uvJ (list tape))]
|
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
|
|
|
|
p:run
|
2017-12-31 09:37:49 +03:00
|
|
|
`tang`[[%leaf (weld name " CRASHED")] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
2018-03-19 06:54:47 +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")] ~]
|
|
|
|
%+ turn p:run
|
2017-12-27 00:03:47 +03:00
|
|
|
|= {i/tape}
|
|
|
|
^- tank
|
|
|
|
[%leaf (weld " " i)]
|
|
|
|
==
|
|
|
|
==
|
2017-12-31 10:23:54 +03:00
|
|
|
::
|
|
|
|
++ match-filter
|
|
|
|
:> checks to see if {name} matches the head of {filter}.
|
2017-12-31 21:41:01 +03:00
|
|
|
|= [filter=path name=term]
|
|
|
|
^- [? path]
|
2017-12-31 10:23:54 +03:00
|
|
|
?~ filter
|
|
|
|
:: when there's no filter, we always match.
|
|
|
|
[%.y ~]
|
|
|
|
[=(i.filter name) t.filter]
|
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]
|
|
|
|
[filter=$?($~ [pax=path $~])]
|
2017-09-25 08:44:45 +03:00
|
|
|
$~
|
|
|
|
==
|
|
|
|
:- %tang
|
2018-01-07 09:51:52 +03:00
|
|
|
%^ test-runner
|
2017-12-31 10:23:54 +03:00
|
|
|
?~ filter ~ pax.filter
|
2018-01-07 09:51:52 +03:00
|
|
|
eny
|
|
|
|
(test-map-to-test-list:tester all-tests)
|