mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 02:11:38 +03:00
tests: test galls can now load %sub and %pub agents
This commit is contained in:
parent
c48c2f4b6a
commit
317f03e337
@ -1,4 +1,4 @@
|
|||||||
/+ *test
|
/+ *test, test-pub, test-sub
|
||||||
/= ames /sys/vane/ames
|
/= ames /sys/vane/ames
|
||||||
/= gall-raw /sys/vane/gall
|
/= gall-raw /sys/vane/gall
|
||||||
::
|
::
|
||||||
@ -8,12 +8,16 @@
|
|||||||
++ gall-gate _(make-gall ~zod)
|
++ gall-gate _(make-gall ~zod)
|
||||||
++ nec-bud
|
++ nec-bud
|
||||||
=/ a ames-nec-bud
|
=/ a ames-nec-bud
|
||||||
:* nec=[ames=nec.a gall=(make-gall ~nec)]
|
=/ gall-nec (make-gall ~nec)
|
||||||
bud=[ames=bud.a gall=(make-gall ~bud)]
|
=. gall-nec (load-agent ~nec gall-nec %sub test-sub)
|
||||||
|
=/ gall-bud (make-gall ~bud)
|
||||||
|
=. gall-bud (load-agent ~bud gall-bud %pub test-pub)
|
||||||
|
:* nec=[ames=nec.a gall=gall-nec]
|
||||||
|
bud=[ames=bud.a gall=gall-bud]
|
||||||
==
|
==
|
||||||
:: +gall-call: have %gall run a +task and assert it produces expected-moves
|
:: +gall-check-call: run gall task, assert produces expected-moves
|
||||||
::
|
::
|
||||||
++ gall-call
|
++ gall-check-call
|
||||||
|= $: =gall-gate
|
|= $: =gall-gate
|
||||||
now=@da
|
now=@da
|
||||||
scry=roof
|
scry=roof
|
||||||
@ -34,6 +38,16 @@
|
|||||||
::
|
::
|
||||||
[output +.res]
|
[output +.res]
|
||||||
::
|
::
|
||||||
|
++ gall-call
|
||||||
|
|= [=gall-gate =duct task=(hobo task:gall) =roof]
|
||||||
|
%. [duct dud=~ task]
|
||||||
|
call:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||||
|
::
|
||||||
|
++ gall-take
|
||||||
|
|= [=gall-gate =wire =duct =sign-arvo =roof]
|
||||||
|
%. [wire duct dud=~ sign-arvo]
|
||||||
|
take:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||||
|
::
|
||||||
++ ames-nec-bud
|
++ ames-nec-bud
|
||||||
:: create ~nec
|
:: create ~nec
|
||||||
::
|
::
|
||||||
@ -100,4 +114,21 @@
|
|||||||
=/ gall-core (gall-pupa now=~1111.1.1 eny=`@`0xdead.beef scry=*roof)
|
=/ gall-core (gall-pupa now=~1111.1.1 eny=`@`0xdead.beef scry=*roof)
|
||||||
=+ [out adult]=(call:gall-core duct=~[/init] dud=~ task=[%init ~])
|
=+ [out adult]=(call:gall-core duct=~[/init] dud=~ task=[%init ~])
|
||||||
adult
|
adult
|
||||||
|
::
|
||||||
|
++ load-agent
|
||||||
|
|= [=ship =gall-gate =dude:gall =agent:gall]
|
||||||
|
=^ * gall-gate
|
||||||
|
(gall-call gall-gate ~[/jolt] [%jolt %base dude] *roof)
|
||||||
|
=^ * gall-gate
|
||||||
|
=/ =sign-arvo
|
||||||
|
:+ %clay %writ
|
||||||
|
`[[%a da+~1111.1.1 %base] /app/[dude]/hoon vase+!>(!>(agent))]
|
||||||
|
%: gall-take
|
||||||
|
gall-gate
|
||||||
|
/sys/cor/[dude]/(scot %p ship)/base/(scot %da ~1111.1.1)
|
||||||
|
~[/jolt]
|
||||||
|
sign-arvo
|
||||||
|
*roof
|
||||||
|
==
|
||||||
|
gall-gate
|
||||||
--
|
--
|
||||||
|
38
pkg/arvo/lib/test/pub.hoon
Normal file
38
pkg/arvo/lib/test/pub.hoon
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/+ default-agent, verb, dbug
|
||||||
|
::
|
||||||
|
=| state=~
|
||||||
|
%- agent:dbug
|
||||||
|
%+ verb &
|
||||||
|
^- agent:gall
|
||||||
|
|_ =bowl:gall
|
||||||
|
+* this .
|
||||||
|
def ~(. (default-agent this %|) bowl)
|
||||||
|
::
|
||||||
|
++ on-poke
|
||||||
|
|= [=mark =vase]
|
||||||
|
(on-poke:def +<)
|
||||||
|
::
|
||||||
|
++ on-watch
|
||||||
|
|= =path
|
||||||
|
~& pub-watch+path
|
||||||
|
(on-watch:def +<)
|
||||||
|
::
|
||||||
|
++ on-agent
|
||||||
|
|= [=wire =sign:agent:gall]
|
||||||
|
(on-agent:def +<)
|
||||||
|
::
|
||||||
|
++ on-fail
|
||||||
|
|= [=term =tang]
|
||||||
|
(mean ':pub +on-fail' term tang)
|
||||||
|
::
|
||||||
|
++ on-leave
|
||||||
|
|= =path
|
||||||
|
~& pub-leave+path
|
||||||
|
`this
|
||||||
|
::
|
||||||
|
++ on-init `this
|
||||||
|
++ on-save !>(state)
|
||||||
|
++ on-load |=(old=vase `this(state !<(_state old)))
|
||||||
|
++ on-arvo on-arvo:def
|
||||||
|
++ on-peek on-peek:def
|
||||||
|
--
|
46
pkg/arvo/lib/test/sub.hoon
Normal file
46
pkg/arvo/lib/test/sub.hoon
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/+ default-agent, verb, dbug
|
||||||
|
::
|
||||||
|
=| state=~
|
||||||
|
%- agent:dbug
|
||||||
|
%+ verb &
|
||||||
|
^- agent:gall
|
||||||
|
|_ =bowl:gall
|
||||||
|
+* this .
|
||||||
|
def ~(. (default-agent this %|) bowl)
|
||||||
|
::
|
||||||
|
++ on-poke
|
||||||
|
|= [=mark =vase]
|
||||||
|
?+ mark !!
|
||||||
|
%leave [[%pass /sub %agent [our.bowl %pub] %leave ~]~ this]
|
||||||
|
%watch [[%pass /sub %agent [our.bowl %pub] %watch /foo]~ this]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ on-watch
|
||||||
|
|= =path
|
||||||
|
(on-watch:def +<)
|
||||||
|
::
|
||||||
|
++ on-agent
|
||||||
|
|= [=wire =sign:agent:gall]
|
||||||
|
?. =(/foo wire)
|
||||||
|
~| wire+wire !!
|
||||||
|
~& sub+-.sign
|
||||||
|
?+ -.sign !!
|
||||||
|
%kick [[%pass /sub %agent [our.bowl %pub] %watch /foo]~ this]
|
||||||
|
%fact `this
|
||||||
|
%watch-ack `this
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ on-fail
|
||||||
|
|= [=term =tang]
|
||||||
|
(mean ':sub +on-fail' term tang)
|
||||||
|
::
|
||||||
|
++ on-leave
|
||||||
|
|= =path
|
||||||
|
`this
|
||||||
|
::
|
||||||
|
++ on-init ~& %sub-on-init `this
|
||||||
|
++ on-save !>(state)
|
||||||
|
++ on-load |=(old=vase `this(state !<(_state old)))
|
||||||
|
++ on-arvo on-arvo:def
|
||||||
|
++ on-peek on-peek:def
|
||||||
|
--
|
@ -2,7 +2,7 @@
|
|||||||
::
|
::
|
||||||
/+ *test, vane-test
|
/+ *test, vane-test
|
||||||
|%
|
|%
|
||||||
++ test-nec-bud
|
++ test-setup-nec-bud
|
||||||
=+ nec-bud:vane-test
|
=+ nec-bud:vane-test
|
||||||
;: weld
|
;: weld
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
|
Loading…
Reference in New Issue
Block a user