summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-01-02 19:10:02 +0100
committerLeah Neukirchen <leah@vuxu.org>2023-01-02 19:10:02 +0100
commit5e79d95159a6cd680d045314fe427b263e7ab344 (patch)
treeb70a26a8bc1721ec08c270db5f1d8a704dfa6bc3 /tests
parent909cf1ba9001f52afbbb6f7cfb6c919869c068ac (diff)
downloadmew-5e79d95159a6cd680d045314fe427b263e7ab344.tar.gz
mew-5e79d95159a6cd680d045314fe427b263e7ab344.tar.xz
mew-5e79d95159a6cd680d045314fe427b263e7ab344.zip
add push!, pop!
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test.mew b/tests/test.mew
index 44fdb95..d2eacbd 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -114,6 +114,14 @@
   (test 5 (loc (x 6) (dec! x)))
   (test 5 (loc (x 7) (dec! x 2))))
 
+(test-group "push!"
+  (test '(3 2 1) (loc (l '()) (push! l 1) (push! l 2) (push! l 3) l)))
+
+(test-group "pop!"
+  (test 1 (loc (l '(3 2 1)) (pop! l) (pop! l) (pop! l)))
+  (test-error (loc (l '(2 1)) (pop! l) (pop! l) (pop! l)))
+  (test 'foo (loc (l '(2 1)) (pop! l) (pop! l) (pop! l 'foo))))
+
 (test-group "boolean"
   (test #f (boolean #f))
   (test #t (boolean #t))