From 2c8ea7f35fadd2a07e53f40fbf5e873573871e25 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 7 Nov 2022 22:35:46 +0100 Subject: add =>, set=>, and=> --- tests/test.mew | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/test.mew b/tests/test.mew index 9cbef3e..c8c9d16 100644 --- a/tests/test.mew +++ b/tests/test.mew @@ -434,6 +434,28 @@ (test 43 (act '(6 7) (op apply * _) inc)) (test 42 (act 42))) +(test-group "=>" + (test 42 (=> 40 inc inc)) + (test #f (=> 40 inc even?)) + (test 43 (=> '(6 7) (op apply * _) inc)) + (test 42 (=> 42))) + +(test-group "set=>" + (test 42 (seq + (def x 40) + (set=> x inc inc) + x)) + (test 42 (seq + (def x #(13/2 2 3)) + (set=> (at x 0) (juxt ceil floor) *) + (at x 0)))) + +(test-group "and=>" + (test #t (and=> 42 even?)) + (test #f (and=> #f even?)) + (test 42 (and=> 40 inc inc)) + (test #f (and=> 40 odd? inc))) + (test-group "void" (test #t (void? (void))) (test #t (void? (void 1 2 3)))) -- cgit 1.4.1