From 71cffc973dd52dcf353be6b04b1f521d3c6681aa Mon Sep 17 00:00:00 2001 From: Ian Shehadeh Date: Wed, 19 Jan 2022 14:01:28 -0500 Subject: [PATCH] add test: destructure with a nested tuple before & This test ensures rest patterns work when preceded by a more complicated pattern. --- test/suite0001.janet | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/suite0001.janet b/test/suite0001.janet index 3faf2963..f4d9523c 100644 --- a/test/suite0001.janet +++ b/test/suite0001.janet @@ -151,6 +151,12 @@ (assert (= a :a) "tuple destructuring 6 - rest") (assert (= b :b) "tuple destructuring 7 - rest") (assert (= rest [nil :d]) "tuple destructuring 8 - rest")) +(do + (def [[a b] x & rest] [[1 2] :a :c :b :a]) + (assert (= a 1) "tuple destructuring 9 - rest") + (assert (= b 2) "tuple destructuring 10 - rest") + (assert (= x :a) "tuple destructuring 11 - rest") + (assert (= rest [:c :b :a]) "tuple destructuring 12 - rest")) # Marshal