shrub/tests/new-hoon/thr.hoon
2018-03-09 19:27:32 -08:00

28 lines
518 B
Plaintext

:: tests for the either core.
/+ new-hoon, tester
=, thr:new-hoon
=/ data/(list (either @u tape)) [[%& 1] [%| "one"] [%& 2] [%| "two"] ~]
|_ _tester:tester
++ test-apply
%+ expect-eq
%^ apply `(either @u tape)`[%| "one"]
|=(a/@u "left")
|=(b/tape "right")
"right"
::
++ test-firsts
%+ expect-eq
(firsts data)
[1 2 ~]
::
++ test-seconds
%+ expect-eq
(seconds data)
["one" "two" ~]
::
++ test-partition
%+ expect-eq
(partition data)
[[1 2 ~] ["one" "two" ~]]
--