Execute /| in scaffolds

This commit is contained in:
Elliot Glaysher 2018-05-18 13:19:35 -07:00
parent 6f8ea7918e
commit ef87e14f33
2 changed files with 123 additions and 0 deletions

View File

@ -88,6 +88,8 @@
test-core-fsdt-fskt
test-core-fskt-nest-fail
test-core-fssm
test-core-fsbr
test-core-fsbr-out-of-options
==
++ test-tear
~& %test-tear
@ -4278,6 +4280,113 @@
(expect-ford-empty ford ~nul)
==
::
++ test-core-fsbr
~& %test-core-fsbr
::
=/ ford *ford-gate
::
=/ hoon-src-type=type [%atom %$ ~]
=/ scry-results=(map [term beam] cage)
%- my :~
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]]
:- %hoon
:- hoon-src-type
'''
/= data /| /^ (list @u)
/~ 5
::
/^ (list @u)
/~ [6 6 ~]
==
data
'''
==
::
=^ results1 ford
%- test-ford-call-with-comparator :*
ford
now=~1234.5.6
scry=(scry-with-results scry-results)
::
^= call-args
:* duct=~[/path] type=~ %make ~nul
%pin ~1234.5.6
[%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]]
==
::
^= comparator
|= moves=(list move:ford-gate)
::
?> =(1 (lent moves))
?> ?=(^ moves)
?> ?=([* %give %made @da %complete %success %pin *] i.moves)
=/ result result.p.card.i.moves
=/ pin-result build-result.result
?> ?=([%success %core *] build-result.pin-result)
::
=/ =vase vase.build-result.pin-result
::
%+ weld
%- expect-eq !>
:- [6 6 ~]
q.vase
::
%- expect-eq !>
:- &
(~(nest ut p.vase) | -:!>([6 6 ~]))
==
::
;: weld
results1
(expect-ford-empty ford ~nul)
==
::
++ test-core-fsbr-out-of-options
~& %test-core-fsbr-out-of-options
::
=/ ford *ford-gate
::
=/ hoon-src-type=type [%atom %$ ~]
=/ scry-results=(map [term beam] cage)
%- my :~
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]]
:- %hoon
:- hoon-src-type
'''
/= data /| /^ (list @u)
/~ 5
::
/^ @u
/~ [6 6 ~]
==
data
'''
==
::
=^ results1 ford
%- test-ford-call :*
ford
now=~1234.5.6
scry=(scry-with-results scry-results)
::
^= call-args
:* duct=~[/path] type=~ %make ~nul
%pin ~1234.5.6
[%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]]
==
::
^= moves
:~ :* duct=~[/path] %give %made ~1234.5.6 %complete %success
%pin ~1234.5.6 %error
:~ [%leaf "ford: %core failed: "]
[%leaf "/| failed: out of options"]
== == == ==
::
;: weld
results1
(expect-ford-empty ford ~nul)
==
::
:: |utilities: helper arms
::
::+| utilities

View File

@ -3111,6 +3111,7 @@
::
|^ ?+ -.crane !!
%fssg (run-fssg +.crane)
%fsbr (run-fsbr +.crane)
%fsts (run-fsts +.crane)
%fsdt (run-fsdt +.crane)
%fssm (run-fssm +.crane)
@ -3131,6 +3132,19 @@
[[%error [leaf+"/~ failed: " message.u.ride-result]] ..run-crane]
?> ?=([~ %success %ride *] ride-result)
[[%subject vase.u.ride-result] ..run-crane]
:: +run-fsbr: runes the `/|` rune
::
++ run-fsbr
|= choices=(list ^crane)
^- compose-cranes
::
?~ choices
[[%error [leaf+"/| failed: out of options"]~] ..run-crane]
::
=^ child ..run-crane (run-crane subject i.choices)
?. ?=([%error *] child)
[child ..run-crane]
$(choices t.choices)
:: +run-fsts: runs the `/=` rune
::
++ run-fsts