jock-lang/hoon/main.hoon
Sigilante eba0ce2a8f
Some checks failed
Build / Get Choo (push) Has been cancelled
Build / Build Jock Test executable (push) Has been cancelled
Implement basic Hoon testing pattern. (#11)
* Fix preliminaries like else keyword.

* WIP but commit version in issue #10

* Post working testing framework.

* Post generated tests.

* Post with jamfile.

* Post checked testing pattern.

* Post instructions.
2024-11-25 13:01:20 -06:00

73 lines
1.4 KiB
Plaintext

/+ jock,
sequent,
test-jock,
*wrapper
=>
|%
+$ test-state ~
++ moat (keep test-state)
+$ cause
$% [%test-n n=@]
[%test-all ~]
==
+$ effect ~
--
%- moat
^- fort:moat
|_ k=test-state
::
:: +load: upgrade from previous state
::
++ load
|= arg=*
^- [(list *) *]
!!
::
:: +peek: external inspect
::
++ peek
|= =path
~
::
:: +poke: external apply
::
++ poke
|= [eny=@ our=@ux now=@da dat=*]
^- [(list effect) test-state]
~& "poked at {<now^dat>}"
=/ soft-cau ((soft cause) dat)
?~ soft-cau
~& "could not mold poke type: {<dat>}" !!
=/ c=cause u.soft-cau
|^
~& exec-all:test-jock
~& test-all:test-jock
?- -.c
%test-n [~ k]
%test-all [~ k]
==
++ dump-output
|- !!
:: ~& > " - parsing - "
:: ~& =| results=(list tank)
:: =/ pa parse-all:test-jock
:: |-
:: ?~ pa results
:: $(pa t.pa, results `(list tank)`[(crip "{<i.pa>}") results])
:: ~& > " - jeaming - "
:: ~& =| results=(list tank)
:: =/ pa jeam-all:test-jock
:: |-
:: ?~ pa results
:: $(pa t.pa, results `(list tank)`[(crip "{<i.pa>}") results])
:: ~& > " - minting - "
:: ~& =| results=(list tank)
:: =/ pa mint-all:test-jock
:: |-
:: ?~ pa results
:: $(pa t.pa, results `(list tank)`[(crip "{<i.pa>}") results])
:: ~& > " "
--
--