mirror of
https://github.com/janet-lang/janet
synced 2025-03-12 11:28:10 +00:00
Address #529
This commit is contained in:
parent
12f470ed10
commit
6020106000
@ -1652,7 +1652,7 @@
|
||||
# match data structure template
|
||||
(or isarr (= t :struct) (= t :table))
|
||||
(eachp [i sub-pattern] pattern
|
||||
(when (not= t :array)
|
||||
(when (not isarr)
|
||||
(array/push anda [not= nil (get-sym s i)]))
|
||||
(visit-pattern-2 anda gun preds s i sub-pattern))
|
||||
|
||||
|
@ -125,6 +125,7 @@
|
||||
(assert (= :yes (match {:a 1} {:a _} :yes :no)) "match wildcard 5")
|
||||
(assert (= false (match {:a 1 :b 2 :c 3} {:a a :b _ :c _ :d _} :no {:a _ :b _ :c _} false :no)) "match wildcard 6")
|
||||
(assert (= nil (match {:a 1 :b 2 :c 3} {:a a :b _ :c _ :d _} :no {:a _ :b _ :c _} nil :no)) "match wildcard 7")
|
||||
(assert (= "t" (match [true nil] [true _] "t")) "match wildcard 8")
|
||||
|
||||
# Regression #301
|
||||
(def b (buffer/new-filled 128 0x78))
|
||||
|
Loading…
x
Reference in New Issue
Block a user