From a705954b08f959cd13611cfa1d5170f92fcd53e8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 04:21:15 -0400 Subject: [PATCH] -test, -build-file, -build-mark, -build-cast --- pkg/arvo/lib/strandio.hoon | 2 +- pkg/arvo/lib/test/runner.hoon | 39 +++++++++++++++++++++++++++++++++++ pkg/arvo/ted/build-cast.hoon | 12 +++++++++++ pkg/arvo/ted/build-file.hoon | 11 ++++++++++ pkg/arvo/ted/build-mark.hoon | 12 +++++++++++ pkg/arvo/ted/test.hoon | 24 +++++++++++++++++++++ 6 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 pkg/arvo/ted/build-cast.hoon create mode 100644 pkg/arvo/ted/build-file.hoon create mode 100644 pkg/arvo/ted/build-mark.hoon create mode 100644 pkg/arvo/ted/test.hoon diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 8b05e8f39..3734776f6 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -417,7 +417,7 @@ ?~ riot (strand-fail %build-file >arg< ~) ?> =(%vase p.r.u.riot) - (pure:m q.r.u.riot) + (pure:m !<(vase q.r.u.riot)) :: +build-mark: build a mark definition to a $dais :: ++ build-mark diff --git a/pkg/arvo/lib/test/runner.hoon b/pkg/arvo/lib/test/runner.hoon index da61c3c74..75d6d2d5f 100644 --- a/pkg/arvo/lib/test/runner.hoon +++ b/pkg/arvo/lib/test/runner.hoon @@ -10,6 +10,45 @@ +$ test-func (trap tang) -- |% +++ run-test + :: executes an individual test. + |= [pax=path test=test-func] + ^- [ok=? =tang] + =+ name=(spud pax) + =+ run=(mule test) + ?- -.run + %| :- %| :: the stack is already flopped for output? + ;: weld + p.run + `tang`[[%leaf (weld "CRASHED " name)] ~] + == + %& ?: =(~ p.run) + &+[[%leaf (weld "OK " name)] ~] + :: Create a welded list of all failures indented. + :- %| + %- flop + ;: weld + `tang`[[%leaf (weld "FAILED " name)] ~] + ::TODO indent + :: %+ turn p:run + :: |= {i/tape} + :: ^- tank + :: [%leaf (weld " " i)] + p.run + == + == +:: +filter-tests-by-prefix +:: +++ filter-tests-by-prefix + |= [prefix=path tests=(list test)] + ^+ tests + :: + =/ prefix-length=@ud (lent prefix) + :: + %+ skim tests + :: + |= [=path *] + =(prefix (scag prefix-length path)) :: +resolve-test-paths: add test names to file paths to form full identifiers :: ++ resolve-test-paths diff --git a/pkg/arvo/ted/build-cast.hoon b/pkg/arvo/ted/build-cast.hoon new file mode 100644 index 000000000..808859fd0 --- /dev/null +++ b/pkg/arvo/ted/build-cast.hoon @@ -0,0 +1,12 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([a=mark b=mark ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +;< =tube:clay bind:m (build-cast:strandio bek a b) +(pure:m !>(tube)) diff --git a/pkg/arvo/ted/build-file.hoon b/pkg/arvo/ted/build-file.hoon new file mode 100644 index 000000000..a1a6d3ff7 --- /dev/null +++ b/pkg/arvo/ted/build-file.hoon @@ -0,0 +1,11 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([pax=path ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +(build-file:strandio bek (flop pax)) diff --git a/pkg/arvo/ted/build-mark.hoon b/pkg/arvo/ted/build-mark.hoon new file mode 100644 index 000000000..d65fc9d25 --- /dev/null +++ b/pkg/arvo/ted/build-mark.hoon @@ -0,0 +1,12 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([mak=mark ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +;< =dais:clay bind:m (build-mark:strandio bek mak) +(pure:m !>(dais)) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon new file mode 100644 index 000000000..c9015d2fb --- /dev/null +++ b/pkg/arvo/ted/test.hoon @@ -0,0 +1,24 @@ +/- spider +/+ strandio, *test-runner +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<])) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +=| test-arms=(map path (list test-arm)) +|- ^- form:m +=* gather-tests $ +?^ paz + ;< cor=vase bind:m (build-file:strandio bek hoon+(flop i.paz)) + =. test-arms (~(put by test-arms) i.paz (get-test-arms cor)) + gather-tests(paz t.paz) +%- pure:m !> ^= ok +%+ roll (resolve-test-paths test-arms) +|= [[=path =test-func] ok=_`?`%&] +^+ ok +=/ res (run-test path test-func) +%- (slog (flop tang.res)) +&(ok ok.res)