From 5e79d95159a6cd680d045314fe427b263e7ab344 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 2 Jan 2023 19:10:02 +0100 Subject: add push!, pop! --- tests/test.mew | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') 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)) -- cgit 1.4.1