summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-07 22:35:46 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-07 22:35:46 +0100
commit2c8ea7f35fadd2a07e53f40fbf5e873573871e25 (patch)
tree049ea7b29e897a4a946b334673d4e11e26f39613 /tests
parent2caa24615fb6bf3b8339276c6bc8b589a830a785 (diff)
downloadmew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.tar.gz
mew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.tar.xz
mew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.zip
add =>, set=>, and=>
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew22
1 files changed, 22 insertions, 0 deletions
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))))