1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

add test: destructure with a nested tuple before &

This test ensures rest patterns work when
preceded by a more complicated pattern.
This commit is contained in:
Ian Shehadeh 2022-01-19 14:01:28 -05:00
parent a8e49d084b
commit 71cffc973d

View File

@ -151,6 +151,12 @@
(assert (= a :a) "tuple destructuring 6 - rest") (assert (= a :a) "tuple destructuring 6 - rest")
(assert (= b :b) "tuple destructuring 7 - rest") (assert (= b :b) "tuple destructuring 7 - rest")
(assert (= rest [nil :d]) "tuple destructuring 8 - 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 # Marshal