2017-11-14 03:43:39 +03:00
|
|
|
:: todo: think about using horns to import all tests in %/tests?
|
2017-11-27 02:41:49 +03:00
|
|
|
::
|
|
|
|
:: i should be able to use /: ?
|
|
|
|
/+ new-hoon, tester
|
|
|
|
|
2017-12-27 00:03:47 +03:00
|
|
|
:: ok, doing this as a list first. then do it automated. is there an equivalent
|
|
|
|
:: to /_ which works on an arbitrary directory?
|
|
|
|
/= test-thr /: /===/tests/thr /!noun/
|
|
|
|
/= test-myb /: /===/tests/myb /!noun/
|
|
|
|
/= test-ls /: /===/tests/ls /!noun/
|
|
|
|
/= test-mp /: /===/tests/mp /!noun/
|
2017-11-27 02:41:49 +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
|
|
|
:> # %models
|
|
|
|
+|
|
|
|
|
+= tests
|
|
|
|
:> a hierarchical structure of tests
|
|
|
|
:>
|
|
|
|
:> an alphabetically sorted recursive association list
|
|
|
|
:> mapping a part of a path to either a test trap or a
|
|
|
|
:> sublist of the same type.
|
|
|
|
(list (pair term (either (trap (list tape)) tests)))
|
|
|
|
::
|
|
|
|
:> # %traps
|
|
|
|
+|
|
|
|
|
++ gen-tests
|
|
|
|
:> creates a {tests} list out of a vase of a test suite
|
|
|
|
|= [v=vase eny=@uvJ]
|
|
|
|
^- tests
|
|
|
|
=+ arms=(sort (sloe p.v) aor)
|
|
|
|
=+ context=(slop (init-test-vase:tester eny) v)
|
|
|
|
%+ map:ls arms
|
|
|
|
|= arm/term
|
|
|
|
:- arm
|
|
|
|
:- %&
|
|
|
|
|.
|
|
|
|
=/ r (slap context [%cnsg [arm ~] [%$ 3] [[%$ 2] ~]])
|
2017-12-31 09:41:01 +03:00
|
|
|
((hard (list tape)) q:(slap r [%limb %results]))
|
2017-12-31 09:37:49 +03:00
|
|
|
::
|
|
|
|
++ test-runner
|
|
|
|
:> run all tests in {a}.
|
|
|
|
::
|
|
|
|
:: todo: pass in a path to filter on.
|
|
|
|
=| pax/path
|
|
|
|
|= a/tests ^- tang
|
|
|
|
%- concat:ls
|
|
|
|
%+ map:ls a
|
|
|
|
|= b/(pair term (either (trap (list tape)) tests))
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2017-12-31 09:37:49 +03:00
|
|
|
?- -.q.b
|
|
|
|
%& (run-test [p.b pax] p.q.b)
|
|
|
|
%| ^$(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.
|
|
|
|
|= {pax/path test/(trap (list tape))}
|
2017-12-27 00:03:47 +03:00
|
|
|
^- tang
|
2017-12-31 09:37:49 +03:00
|
|
|
=+ name=(spud (reverse:ls pax))
|
|
|
|
=+ run=(mule test)
|
|
|
|
~! run
|
2017-12-27 00:03:47 +03:00
|
|
|
?- -.run
|
|
|
|
$| :: the stack is already flopped for output?
|
|
|
|
;: weld
|
|
|
|
p:run
|
2017-12-31 09:37:49 +03:00
|
|
|
`tang`[[%leaf (weld name " CRASHED")] ~]
|
2017-12-27 00:03:47 +03:00
|
|
|
==
|
2017-12-31 09:37:49 +03:00
|
|
|
$& ?: =(~ p:run)
|
|
|
|
[[%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")] ~]
|
|
|
|
~! p:run
|
|
|
|
%+ turn p:run
|
2017-12-27 00:03:47 +03:00
|
|
|
|= {i/tape}
|
|
|
|
^- tank
|
|
|
|
[%leaf (weld " " i)]
|
|
|
|
==
|
|
|
|
==
|
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
|
|
|
|
|= $: {now/@da eny/@uvJ bec/beak}
|
|
|
|
$~
|
|
|
|
$~
|
|
|
|
==
|
|
|
|
:- %tang
|
2017-12-31 09:37:49 +03:00
|
|
|
%- test-runner
|
|
|
|
^- tests
|
|
|
|
:~
|
|
|
|
:: todo: for now, this is manually constructed. later, this should
|
|
|
|
:: be generated from the contents of %/tests, without addressing the
|
|
|
|
:: files individually. if possible, lift the call to ++gen-tests into
|
|
|
|
:: the build steps for caching.
|
|
|
|
['ls' [%| (gen-tests !>(test-ls) eny)]]
|
|
|
|
['mp' [%| (gen-tests !>(test-mp) eny)]]
|
|
|
|
['myb' [%| (gen-tests !>(test-myb) eny)]]
|
|
|
|
['thr' [%| (gen-tests !>(test-thr) eny)]]
|
|
|
|
==
|