/gen: all generators build

This commit is contained in:
Ted Blackman 2020-05-20 04:51:37 -04:00
parent 96264f7fa3
commit 34038a4616
3 changed files with 1 additions and 162 deletions

View File

@ -1,79 +0,0 @@
:: TODO: modernize for ford fusion; will not parse
/? 309
::
/= pre-process
/^ (map path [@tas @t])
/: /===/web/static-site /*
/| /; |=(@t [%html +<]) /&html&/!hymn/
/; |=(@t [%html +<]) /&html&/&elem&/udon/
:: XX /lib/down-jet/parse is broken
:: /; |=(@t [%html +<]) /&html&/&hymn&/&down&/md/
/; |=(@t [%raw +<]) /atom/
==
::
~& %finished-preprocessing
:- %say
|= $: [now=@da eny=@uv bec=beak]
~
~
==
=>
|%
++ convert-link
|= [pre=tape link=tape]
=/ parsed=(unit (list coin))
%+ rust link
;~ pose
;~(pfix net (more net nuck:so))
(more net nuck:so)
==
?~ parsed
link
^- tape
%+ welp
=< +
%^ spin u.parsed pre
|= [c=coin s=path]
^- [* out=tape]
?> ?=([%$ dime] c)
[0 (weld "{s}/" (scow +.c))]
::
".html"
::
++ convert-file
|= [pre=tape fil=tape]
^- tape
=/ idc=(list @ud) (fand "<a href=" fil)
=< +>
%^ spin idc [0 fil]
|= [i=@ud f=@ud h=tape]
^- [p=* f=@ud out=tape]
=/ a (scag :(add 9 i f) h)
=/ b (slag :(add 9 i f) h)
=/ c (need (find "\">" b))
=/ old-link=tape (scag c b)
=/ new-link=tape (convert-link pre old-link)
=/ new-file=tape :(welp a new-link (slag c b))
=/ new-f (sub (lent new-link) (lent old-link))
[0 (add f new-f) new-file]
--
::
:- %dill-blit
=/ trio /(scot %p p.bec)/[q.bec]/(scot r.bec)
=/ dirs .^((list path) %ct (weld trio /web/static-site))
::
:- %mor
%+ roll dirs
|= [pax=path out=(list [%sav path @t])]
=/ path-prefix=path (scag (dec (lent pax)) pax)
=/ pre=[@tas @t] (~(got by pre-process) path-prefix)
:_ out
:- %sav
?: =(%raw -.pre)
[pax +.pre]
:: find and update links
=/ root=tape
?~ path-prefix ""
(slag 1 (spud (scag 1 (flop path-prefix))))
=/ fil=tape (convert-file root (trip +.pre))
[(weld path-prefix /[-.pre]) (crip fil)]

View File

@ -4,7 +4,7 @@
|= [[now=time @ our=ship ^] [her=ship ~] ~]
=/ our (scot %p our)
=/ now (scot %da now)
=/ her (scot %p ship)
=/ her (scot %p her)
:* %noun
life=.^((unit @ud) %j /[our]/lyfe/[now]/[her])
rift=.^((unit @ud) %j /[our]/ryft/[now]/[her])

View File

@ -1,82 +0,0 @@
/+ test-runner
/= all-tests
/^ (map path (list test-arm:test-runner))
/: /===/tests
/* /test-gen/
::
|%
++ main
|= [defer=? tests=(list test:test-runner)]
^- tang
::
%- zing
%+ turn tests
|= [=path test-func=test-func:test-runner]
^- tang
::
=/ test-results=tang (run-test path test-func)
:: if :defer is set, produce errors; otherwise print them and produce ~
::
?: defer
test-results
((slog (flop test-results)) ~)
::
++ run-test
:: executes an individual test.
|= [pax=path test=test-func:test-runner]
^- 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:test-runner)]
^+ tests
::
=/ prefix-length=@ud (lent prefix)
::
%+ skim tests
::
|= [=path *]
=(prefix (scag prefix-length path))
--
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[filter=$?(~ [pax=path ~])]
[defer=_& seed=?(~ @uvJ)]
==
:: start printing early if we're not deferring output
::
~? !defer %tests-compiled
:- %tang
:: use empty path prefix if unspecified
::
=/ prefix=path ?~(filter ~ pax.filter)
::
=/ filtered-tests=(list test:test-runner)
%+ filter-tests-by-prefix
prefix
(resolve-test-paths:test-runner all-tests)
::
(main defer filtered-tests)