From 5ae2911705d5f907b9355d939c2c72d5c244f2cb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 8 Feb 2021 07:23:21 -0800 Subject: matcher: add @(or) test involving existing variables. * tests/011/patmatch.tl: New test case showing that existing variables that don't match in an @(or) retain their values; they do not become nil, unlike freshly bound variables in non-matching or-clauses. --- tests/011/patmatch.tl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/011') diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index 36e30fb5..abad6b44 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -77,6 +77,11 @@ (test (when-match @(all @(or (@x @y) @z)) '((1 2) (3 4)) (list x y z)) ((1 3) (2 4) (nil nil))) +(test (let ((a 1) (b 2) (c 3)) + (if-match @(or @a @b @c) 2 + (list a b c))) + (1 2 3)) + (test (when-match @(or @(all @x)) '(1 2 3) x) (1 2 3)) (test (when-match (foo @(all @x)) '(bar (1 2 . 3)) x) nil) -- cgit v1.2.3