-test: full path syntax

This commit is contained in:
Ted Blackman 2020-04-20 01:33:29 -04:00
parent d1df818453
commit f3544067af
2 changed files with 53 additions and 4 deletions

View File

@ -543,6 +543,21 @@
;< ~ bind:m (send-raw-card %pass /warp %arvo %c %warp ship riff)
(take-writ /warp)
::
++ read-file
|= [[=ship =desk =case:clay] =spur]
=* arg +<
=/ m (strand ,cage)
;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur))
?~ riot
(strand-fail %read-file >arg< ~)
(pure:m r.u.riot)
::
++ check-for-file
|= [[=ship =desk =case:clay] =spur]
=/ m (strand ,?)
;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur))
(pure:m ?=(^ riot))
::
++ list-tree
|= [[=ship =desk =case:clay] =spur]
=* arg +<

View File

@ -71,6 +71,30 @@
++ has-test-prefix
|= a=term ^- ?
=((end 3 5 a) 'test-')
::
++ find-test-files
=| fiz=(set [=spur test=(unit term)])
=/ m (strand ,_fiz)
|= [bek=beak paz=(list path)]
^- form:m
=* loop $
?~ paz
(pure:m fiz)
=/ xap=path (flop i.paz)
;< hav=? bind:m (check-for-file:strandio bek hoon+xap)
?: hav
loop(paz t.paz, fiz (~(put in fiz) [hoon+xap ~]))
;< fez=(list path) bind:m (list-tree:strandio bek xap)
?. =(~ fez)
=/ foz (turn fez |=(path [(flop +<) ~]))
loop(paz t.paz, fiz (~(gas in fiz) foz))
~| bad-test-path+i.paz
=/ tex=term =-(?>(((sane %tas) -) -) (head xap))
=/ xup=path (tail xap)
;< hov=? bind:m (check-for-file:strandio bek hoon+xup)
?. hov
~|(no-tests-at-path+paz !!)
loop(paz t.paz, fiz (~(put in fiz) [hoon+xup `tex]))
--
^- thread:spider
|= arg=vase
@ -78,13 +102,23 @@
^- form:m
=/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<]))
;< bek=beak bind:m get-beak:strandio
;< fiz=(set [=spur test=(unit term)]) bind:m (find-test-files bek paz)
=> .(fiz ~(tap in fiz))
=| 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)
?^ fiz
~> %slog.0^leaf+"test: building {(spud (flop spur.i.fiz))}"
;< cor=vase bind:m (build-file:strandio bek spur.i.fiz)
=/ arms=(list test-arm) (get-test-arms cor)
=? arms ?=(^ test.i.fiz)
|- ^+ arms
?~ arms ~|(no-test-arm+i.fiz !!)
?: =(name.i.arms u.test.i.fiz)
[i.arms]~
$(arms t.arms)
=. test-arms (~(put by test-arms) (flop (tail spur.i.fiz)) arms)
gather-tests(fiz t.fiz)
%- pure:m !> ^= ok
%+ roll (resolve-test-paths test-arms)
|= [[=path =test-func] ok=_`?`%&]