2020-05-14 10:22:39 +03:00
|
|
|
/+ *test
|
2020-04-19 02:53:45 +03:00
|
|
|
/= clay-raw /sys/vane/clay
|
2021-01-26 23:59:36 +03:00
|
|
|
/* gen-hello %hoon /gen/hello/hoon
|
|
|
|
/* lib-strandio %hoon /lib/strandio/hoon
|
|
|
|
/* lib-strand %hoon /lib/strand/hoon
|
|
|
|
/* sur-spider %hoon /sur/spider/hoon
|
|
|
|
/* mar-mime %hoon /mar/mime/hoon
|
2021-01-27 04:43:23 +03:00
|
|
|
/* mar-html %hoon /mar/html/hoon
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
!:
|
|
|
|
=, format
|
|
|
|
::
|
2020-06-23 01:05:55 +03:00
|
|
|
=/ bud=vase !>(..zuse)
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ clay-gate (clay-raw ~nul)
|
2020-04-16 15:45:48 +03:00
|
|
|
=/ fusion fusion:clay-gate
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
2018-08-30 00:57:22 +03:00
|
|
|
|%
|
2020-04-16 15:45:48 +03:00
|
|
|
++ test-parse-pile ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- pile:fusion
|
2021-02-17 22:31:20 +03:00
|
|
|
:* ~ ~ ~ ~ ~ ~
|
2020-04-19 02:53:45 +03:00
|
|
|
tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~
|
|
|
|
==
|
2020-04-16 15:45:48 +03:00
|
|
|
!> (parse-pile:(ford):fusion /sur/foo/hoon ".")
|
|
|
|
::
|
2020-04-22 12:27:36 +03:00
|
|
|
++ test-parse-multiline-faslus ^- tang
|
|
|
|
=/ src
|
|
|
|
"""
|
|
|
|
:: :: ::
|
|
|
|
:::: /hoon/hood/app :: ::
|
|
|
|
:: :: ::
|
|
|
|
/? 310 :: zuse version
|
|
|
|
/- *sole
|
|
|
|
/+ sole :: libraries
|
|
|
|
:: XX these should really be separate apps, as
|
|
|
|
:: none of them interact with each other in
|
|
|
|
:: any fashion; however, to reduce boot-time
|
|
|
|
:: complexity and work around the current
|
|
|
|
:: non-functionality of end-to-end acknowledgments,
|
|
|
|
:: they have been bundled into :hood
|
|
|
|
::
|
|
|
|
:: |command handlers
|
|
|
|
/+ hood-helm, hood-kiln, hood-drum, hood-write
|
|
|
|
:: :: ::
|
|
|
|
.
|
|
|
|
"""
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- pile:fusion
|
|
|
|
:* sur=`(list taut:fusion)`[~ %sole]~
|
|
|
|
^= lib ^- (list taut:fusion)
|
|
|
|
:~ [`%sole %sole]
|
|
|
|
[`%hood-helm %hood-helm]
|
|
|
|
[`%hood-kiln %hood-kiln]
|
|
|
|
[`%hood-drum %hood-drum]
|
|
|
|
[`%hood-write %hood-write]
|
|
|
|
==
|
2021-02-17 22:31:20 +03:00
|
|
|
raw=~ bar=~ maz=~ caz=~
|
2020-04-22 12:27:36 +03:00
|
|
|
hoon=tssg+[p:(need q:(tall:(vang & /app/hood/hoon) [17 1] "."))]~
|
|
|
|
==
|
|
|
|
!> (parse-pile:(ford):fusion /app/hood/hoon src)
|
|
|
|
::
|
2020-04-16 23:36:16 +03:00
|
|
|
++ test-cycle ^- tang
|
|
|
|
=/ source=@t
|
|
|
|
'''
|
|
|
|
/+ self
|
|
|
|
.
|
|
|
|
'''
|
|
|
|
=/ =ankh:clay
|
|
|
|
:- fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %lib fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %self fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(source)] dir=~
|
|
|
|
== == ==
|
|
|
|
%- expect-fail
|
|
|
|
|.
|
|
|
|
=/ ford
|
|
|
|
%: ford:fusion
|
2020-06-23 01:05:55 +03:00
|
|
|
bud
|
2020-04-16 23:36:16 +03:00
|
|
|
ankh
|
|
|
|
deletes=~
|
|
|
|
changes=~
|
|
|
|
file-store=~
|
|
|
|
*ford-cache:fusion
|
|
|
|
==
|
|
|
|
(build-file:ford /lib/self/hoon)
|
|
|
|
::
|
2020-04-16 16:08:18 +03:00
|
|
|
++ test-parse-fail ^- tang
|
2020-04-16 16:40:59 +03:00
|
|
|
%- expect-fail
|
2020-04-16 16:08:18 +03:00
|
|
|
|. (parse-pile:(ford):fusion /sur/foo/hoon "[")
|
|
|
|
::
|
2021-01-26 23:59:36 +03:00
|
|
|
++ test-mar-mime ^- tang
|
|
|
|
=/ ford
|
|
|
|
%: ford:fusion
|
|
|
|
bud
|
2021-01-27 04:43:23 +03:00
|
|
|
*ankh:clay
|
2021-01-26 23:59:36 +03:00
|
|
|
deletes=~
|
|
|
|
changes=(my [/mar/mime/hoon &+hoon+mar-mime]~)
|
|
|
|
file-store=~
|
|
|
|
*ford-cache:fusion
|
|
|
|
==
|
|
|
|
=/ [res=vase nub=state:ford:fusion] (get-nave:ford %mime)
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!>(*mime)
|
|
|
|
(slap res limb/%bunt)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> (~(gas in *(set path)) /mar/mime/hoon ~)
|
|
|
|
!> dez:(~(got by vases.cache.nub) /mar/mime/hoon)
|
|
|
|
==
|
|
|
|
::
|
2021-01-27 04:43:23 +03:00
|
|
|
++ test-cast-html-mime ^- tang
|
|
|
|
=/ changes
|
|
|
|
%- my
|
|
|
|
:~ [/mar/mime/hoon &+hoon+mar-mime]
|
|
|
|
[/mar/html/hoon &+hoon+mar-html]
|
|
|
|
==
|
|
|
|
=/ ford
|
|
|
|
%: ford:fusion
|
|
|
|
bud
|
|
|
|
*ankh:clay
|
|
|
|
deletes=~
|
|
|
|
changes
|
|
|
|
file-store=~
|
|
|
|
*ford-cache:fusion
|
|
|
|
==
|
|
|
|
=/ [res=vase nub=state:ford:fusion] (get-cast:ford %html %mime)
|
|
|
|
%+ expect-eq
|
|
|
|
(slam res !>('<html></html>'))
|
|
|
|
!> `mime`[/text/html 13 '<html></html>']
|
|
|
|
::
|
2021-01-26 23:59:36 +03:00
|
|
|
++ test-gen-hello ^- tang
|
2020-04-16 15:45:48 +03:00
|
|
|
=/ =ankh:clay
|
|
|
|
:- fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %gen fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %hello fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
2021-01-26 23:59:36 +03:00
|
|
|
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(gen-hello)] dir=~
|
2020-04-16 15:45:48 +03:00
|
|
|
== == ==
|
|
|
|
=/ ford
|
|
|
|
%: ford:fusion
|
2020-06-23 01:05:55 +03:00
|
|
|
bud
|
2020-04-16 15:45:48 +03:00
|
|
|
ankh
|
|
|
|
deletes=~
|
2021-01-26 23:59:36 +03:00
|
|
|
changes=(my [/gen/hello/hoon &+hoon+gen-hello]~)
|
2020-04-16 15:45:48 +03:00
|
|
|
file-store=~
|
|
|
|
*ford-cache:fusion
|
|
|
|
==
|
2020-04-16 23:46:45 +03:00
|
|
|
=/ [res=vase nub=state:ford:fusion] (build-file:ford /gen/hello/hoon)
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!> noun+'hello, bob'
|
|
|
|
(slap res (ream '(+ [*^ [%bob ~] ~])'))
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> (~(gas in *(set path)) /gen/hello/hoon ~)
|
|
|
|
!> dez:(~(got by vases.cache.nub) /gen/hello/hoon)
|
|
|
|
==
|
2020-04-16 15:45:48 +03:00
|
|
|
::
|
2021-01-26 23:59:36 +03:00
|
|
|
++ test-lib-strandio ^- tang
|
2020-04-16 23:58:45 +03:00
|
|
|
=/ =ankh:clay
|
|
|
|
:- fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %lib fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %strandio fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
2021-01-26 23:59:36 +03:00
|
|
|
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(lib-strandio)] dir=~
|
2020-04-16 23:58:45 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:+ %strand fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
2021-01-26 23:59:36 +03:00
|
|
|
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(lib-strand)] dir=~
|
2020-04-16 23:58:45 +03:00
|
|
|
== ==
|
|
|
|
::
|
|
|
|
:+ %sur fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
|
|
|
:~ :+ %spider fil=~
|
|
|
|
%- ~(gas by *(map @tas ankh:clay))
|
2021-01-26 23:59:36 +03:00
|
|
|
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(sur-spider)] dir=~
|
2020-04-16 23:58:45 +03:00
|
|
|
== == ==
|
|
|
|
=/ ford
|
|
|
|
%: ford:fusion
|
2020-06-23 01:05:55 +03:00
|
|
|
bud
|
2020-04-16 23:58:45 +03:00
|
|
|
ankh
|
|
|
|
deletes=~
|
|
|
|
changes=~
|
|
|
|
file-store=~
|
|
|
|
*ford-cache:fusion
|
|
|
|
==
|
|
|
|
=/ [res=vase nub=state:ford:fusion] (build-file:ford /lib/strandio/hoon)
|
|
|
|
;: weld
|
|
|
|
%- expect
|
2020-06-28 07:59:02 +03:00
|
|
|
!>((slab %read %get-our -.res))
|
2020-04-16 23:58:45 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> %- ~(gas in *(set path))
|
|
|
|
:~ /lib/strandio/hoon
|
|
|
|
/lib/strand/hoon
|
|
|
|
/sur/spider/hoon
|
|
|
|
==
|
|
|
|
!> dez:(~(got by vases.cache.nub) /lib/strandio/hoon)
|
|
|
|
==
|
2020-04-19 02:53:45 +03:00
|
|
|
::
|
2020-04-19 03:01:26 +03:00
|
|
|
:: |utilities: helper functions for testing
|
|
|
|
::
|
|
|
|
:: TODO: make these utilities generic for any vane
|
|
|
|
::
|
|
|
|
::+| utilities
|
|
|
|
::
|
|
|
|
:: +clay-call: have clay run a +task and assert it produces :expected-moves7890
|
|
|
|
::
|
|
|
|
++ clay-call
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
2020-11-26 21:12:35 +03:00
|
|
|
scry=roof
|
2020-12-08 03:47:06 +03:00
|
|
|
call-args=[=duct wrapped-task=(hobo task:clay)]
|
2020-04-19 03:01:26 +03:00
|
|
|
expected-moves=(list move:clay-gate)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ clay-core (clay-gate now=now eny=`@`0xdead.beef scry=scry)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=^ moves clay-gate (call:clay-core [duct ~ wrapped-task]:call-args)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
|
|
|
=/ output=tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> expected-moves
|
|
|
|
!> moves
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
:: +clay-call-with-comparator: run a clay +task and test output moves
|
|
|
|
::
|
|
|
|
++ clay-call-with-comparator
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
2020-11-26 21:12:35 +03:00
|
|
|
scry=roof
|
2020-12-08 03:47:06 +03:00
|
|
|
call-args=[=duct wrapped-task=(hobo task:clay)]
|
2020-04-19 03:01:26 +03:00
|
|
|
move-comparator=$-((list move:clay-gate) tang)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ clay-core (clay-gate now=now eny=`@`0xdead.beef scry=scry)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=^ moves clay-gate (call:clay-core [duct ~ wrapped-task]:call-args)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
|
|
|
=/ output=tang (move-comparator moves)
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
:: +clay-take: have clay receive a +note and assert output moves
|
|
|
|
::
|
|
|
|
++ clay-take
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
2020-11-26 21:12:35 +03:00
|
|
|
scry=roof
|
2020-12-06 11:38:37 +03:00
|
|
|
take-args=[=wire =duct =sign:clay-gate]
|
2020-04-19 03:01:26 +03:00
|
|
|
expected-moves=(list move:clay-gate)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ clay-core (clay-gate now=now eny=`@`0xdead.beef scry=scry)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=^ moves clay-gate (take:clay-core [wire duct ~ sign]:take-args)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
|
|
|
=/ output=tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> expected-moves
|
|
|
|
!> moves
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
:: +clay-take-with-comparator: have clay receive a +note and test output moves
|
|
|
|
::
|
|
|
|
++ clay-take-with-comparator
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
2020-11-26 21:12:35 +03:00
|
|
|
scry=roof
|
2020-12-06 11:38:37 +03:00
|
|
|
take-args=[=wire =duct =sign:clay-gate]
|
2020-04-19 03:01:26 +03:00
|
|
|
move-comparator=$-((list move:clay-gate) tang)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ clay-core (clay-gate now=now eny=`@`0xdead.beef scry=scry)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=^ moves clay-gate (take:clay-core [wire duct ~ sign]:take-args)
|
2020-04-19 03:01:26 +03:00
|
|
|
::
|
|
|
|
=/ output=tang (move-comparator moves)
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
--
|