From f9a4c8791bf2133b12ab4b73aa42f17bcea52e56 Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Mon, 21 May 2018 13:34:56 -0700 Subject: [PATCH] Execute /, in scaffolds --- gen/ford-turbo.hoon | 72 +++++++++++++++++++++++++++++++++++++++++++++ lib/ford-turbo.hoon | 15 ++++++++++ 2 files changed, 87 insertions(+) diff --git a/gen/ford-turbo.hoon b/gen/ford-turbo.hoon index 69ccd8241..5e11ff799 100644 --- a/gen/ford-turbo.hoon +++ b/gen/ford-turbo.hoon @@ -93,6 +93,7 @@ test-core-fsbr-out-of-options test-plan-fszp-as-noun test-core-fscl-fszp + test-core-fscm test-bunt == ++ test-tear @@ -4616,6 +4617,77 @@ (expect-ford-empty ford ~nul) == :: +++ test-core-fscm + :- `tank`leaf+"test-core-fscm" + :: + =/ 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 /: /===/data/hoon + /!noun/ + data + ''' + :: + :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]] + :- %hoon + :- hoon-src-type + ''' + /, /other/hoon + /~ a=[3 2 1 ~] + :: + /data/hoon + /~ a=[1 2 3 ~] + == + a + ''' + == + :: + =^ 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 !> + :- [1 2 3 ~] + q.vase + :: + %- expect-eq !> + :- & + (~(nest ut p.vase) | -:!>([1 2 3 ~])) + == + :: + ;: weld + results1 + (expect-ford-empty ford ~nul) + == +:: ++ test-bunt :- `tank`leaf+"test-bunt" :: diff --git a/lib/ford-turbo.hoon b/lib/ford-turbo.hoon index 8466e0d10..5cf636034 100644 --- a/lib/ford-turbo.hoon +++ b/lib/ford-turbo.hoon @@ -3157,6 +3157,7 @@ %fssg (run-fssg +.crane) %fsbr (run-fsbr +.crane) %fsts (run-fsts +.crane) + %fscm (run-fscm +.crane) %fsdt (run-fsdt +.crane) %fssm (run-fssm +.crane) %fscl (run-fscl +.crane) @@ -3202,6 +3203,20 @@ [child ..run-crane] :_ ..run-crane [%subject [[%face [~ face] p.subject.child] q.subject.child]] + :: +run-fscm: runs the `/,` rune + :: + ++ run-fscm + |= cases=(list [=spur crane=^crane]) + ^- compose-cranes + :: + ?~ cases + [[%error [leaf+"/, failed: no match"]~] ..run-crane] + :: + ?. .= spur.i.cases + (scag (lent spur.i.cases) (flop spur.path-to-render)) + $(cases t.cases) + :: + (run-crane subject crane.i.cases) :: +run-fsdt: runs the `/.` rune :: ++ run-fsdt