shrub/tests/new-hoon/thr.hoon
Anton Dyudin d0138ff7fa fix #654 by having assert-eq accept a vase of a pair
flipping the order of the pair while rewriting all the test was necessary anyawy, to accoutn for heavier-twig tendencies
2018-03-09 19:43:35 -08:00

28 lines
538 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 !>
:- "right"
%^ apply `(either @u tape)`[%| "one"]
|=(a/@u "left")
|=(b/tape "right")
::
++ test-firsts
%- expect-eq !>
:- [1 2 ~]
(firsts data)
::
++ test-seconds
%- expect-eq !>
:- ["one" "two" ~]
(seconds data)
::
++ test-partition
%- expect-eq !>
:- [[1 2 ~] ["one" "two" ~]]
(partition data)
--