mirror of
https://github.com/urbit/shrub.git
synced 2025-01-05 19:46:50 +03:00
add test for changing a file
This commit is contained in:
parent
6337c9162b
commit
7f8e3daaaf
@ -111,8 +111,13 @@
|
||||
=/ res (mox +46.snap)
|
||||
?> ?=(%0 -.res)
|
||||
=/ peek p.res
|
||||
~& [who=who %peeked (slum peek [now.hid p])]
|
||||
..abet-pe
|
||||
=/ pax (path p)
|
||||
~& [who=who %peeking-in tym pax]
|
||||
?> ?=([@ @ @ @ *] pax)
|
||||
=. i.t.t.t.pax (scot %da tym)
|
||||
=/ pek (slum peek [tym pax])
|
||||
~& [who=who %peeked]
|
||||
pek
|
||||
::
|
||||
:: Wish
|
||||
::
|
||||
@ -521,7 +526,8 @@
|
||||
%+ turn-ships ((list ship) hers.val)
|
||||
|= [who=ship thus=_this]
|
||||
=. this thus
|
||||
(peek:(pe who) p.val)
|
||||
~& [who=who %peek-result (peek:(pe who) p.val)]
|
||||
(pe who)
|
||||
::
|
||||
[%wish hers=* p=@t]
|
||||
%+ turn-ships ((list ship) hers.val)
|
||||
@ -739,6 +745,21 @@
|
||||
:^ ~ ~ %noun
|
||||
(~(has by fleet-snaps) i.pax)
|
||||
::
|
||||
::
|
||||
::
|
||||
++ peek-x-i
|
||||
|= pax=path
|
||||
^- (unit (unit [%noun noun]))
|
||||
~& [%peeking-i pax]
|
||||
?. ?=([@ @ @ *] pax)
|
||||
~
|
||||
=/ who (slav %p i.pax)
|
||||
=/ pier (~(get by piers) who)
|
||||
?~ pier
|
||||
~
|
||||
:^ ~ ~ %noun
|
||||
(peek:(pe who) [%cx pax])
|
||||
::
|
||||
:: Trivial scry for mock
|
||||
::
|
||||
++ scry |=([* *] ~)
|
||||
|
63
app/ph.hoon
63
app/ph.hoon
@ -133,16 +133,23 @@
|
||||
[%test-done &]~
|
||||
--
|
||||
::
|
||||
:- %child-sync
|
||||
:- %change-file
|
||||
%+ compose-tests (galaxy ~bud)
|
||||
^- test-core
|
||||
=| warped=@t
|
||||
|%
|
||||
++ label %child-sync
|
||||
++ ships ~[~bud ~marbud ~linnup-torsyx]
|
||||
++ label %change-file
|
||||
++ ships ~
|
||||
++ start
|
||||
|= now=@da
|
||||
^- (pair (list ph-event) _..start)
|
||||
=/ pax
|
||||
/(scot %p our.hid)/home/(scot %da now.hid)/sur/aquarium/hoon
|
||||
=. warped (cat 3 '=> . ' .^(@t %cx pax))
|
||||
:_ ..start
|
||||
%- zing
|
||||
:~ (init ~bud)
|
||||
:~ (dojo ~bud "|mount %")
|
||||
(insert-file ~bud pax warped)
|
||||
==
|
||||
::
|
||||
++ route
|
||||
@ -150,47 +157,17 @@
|
||||
^- (quip ph-event _..start)
|
||||
:_ ..start
|
||||
%- zing
|
||||
:~
|
||||
%- on-dojo-output
|
||||
:^ ~bud who ovo
|
||||
:- "+ /~bud/base/2/web/testing/udon"
|
||||
|= ~
|
||||
(init ~marbud)
|
||||
::
|
||||
%- on-dojo-output
|
||||
:^ ~marbud who ovo
|
||||
:- "; ~bud is your neighbor"
|
||||
|= ~
|
||||
(init ~linnup-torsyx)
|
||||
::
|
||||
%- on-dojo-output
|
||||
:^ ~linnup-torsyx who ovo
|
||||
:- "; ~bud is your neighbor"
|
||||
|= ~
|
||||
(dojo ~linnup-torsyx "|hi ~bud")
|
||||
::
|
||||
%- on-dojo-output
|
||||
:^ ~linnup-torsyx who ovo
|
||||
:- "hi ~bud successful"
|
||||
:: :- "; ~bud is your neighbor"
|
||||
|= ~
|
||||
[%test-done &]~
|
||||
:~ %- on-ergo
|
||||
:^ ~bud who ovo
|
||||
|= $~
|
||||
=/ pax /i/~bud/home/(scot %da now)/sur/aquarium/hoon/noun
|
||||
~& [%compare (met 3 warped) (met 3 (need (scry-aqua (unit @) now pax)))]
|
||||
?: =(warped (need (scry-aqua (unit @) now pax)))
|
||||
[%test-done &]~
|
||||
~& %not-done-yet
|
||||
~
|
||||
==
|
||||
--
|
||||
:: (dojo ~bud "\"magic-go\":[.^(")
|
||||
:: (dojo ~bud "|mount %")
|
||||
:: %+ insert-file ~bud
|
||||
:: /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/clay/hoon
|
||||
:: (init ~marbud)
|
||||
:: (dojo ~marbud "|mount %")
|
||||
:: %+ insert-file ~marbud
|
||||
:: /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/clay/hoon
|
||||
::
|
||||
:: (init ~zod)
|
||||
:: (init ~marzod)
|
||||
:: wait for initial sync
|
||||
:: change file on zod
|
||||
:: check on ~marzod
|
||||
::
|
||||
:- %individual-breach
|
||||
*test-core
|
||||
|
30
lib/ph.hoon
30
lib/ph.hoon
@ -62,10 +62,10 @@
|
||||
==
|
||||
::
|
||||
++ insert-file
|
||||
|= [who=ship pax=path]
|
||||
|= [who=ship pax=path txt=@t]
|
||||
^- (list ph-event)
|
||||
?> ?=([@ @ @ *] pax)
|
||||
=/ file [/text/plain (as-octs:mimes:html .^(@ %cx pax))]
|
||||
=/ file [/text/plain (as-octs:mimes:html txt)]
|
||||
%+ send-events-to who
|
||||
:~
|
||||
[//sync/0v1n.2m9vh %into i.t.pax | [t.t.t.pax `file]~]
|
||||
@ -95,6 +95,14 @@
|
||||
|= ~
|
||||
[%test-done &]~
|
||||
::
|
||||
++ on-ergo
|
||||
|= [who=ship her=ship ovo=unix-effect fun=$-($~ (list ph-event))]
|
||||
?. =(who her)
|
||||
~
|
||||
?. ?=(%ergo -.q.ovo)
|
||||
~
|
||||
(fun)
|
||||
::
|
||||
++ test-lib
|
||||
|_ our=ship
|
||||
++ compose-tests
|
||||
@ -117,13 +125,7 @@
|
||||
|= now=@da
|
||||
^- (quip ph-event _..start)
|
||||
=/ have-cache
|
||||
.^ @f
|
||||
%gx
|
||||
(scot %p our)
|
||||
%aqua
|
||||
(scot %da now)
|
||||
/fleet-snap/[label:a]/noun
|
||||
==
|
||||
(scry-aqua ? now /fleet-snap/[label:a]/noun)
|
||||
~& [%have-cache label:a have-cache]
|
||||
?: have-cache
|
||||
=. done-with-a &
|
||||
@ -228,5 +230,15 @@
|
||||
%earl ~|(%moon-not-implemented !!)
|
||||
%pawn ~|(%comet-not-implemented !!)
|
||||
==
|
||||
::
|
||||
++ scry-aqua
|
||||
|* [a=mold now=@da pax=path]
|
||||
.^ a
|
||||
%gx
|
||||
(scot %p our)
|
||||
%aqua
|
||||
(scot %da now)
|
||||
pax
|
||||
==
|
||||
--
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user