mirror of
https://github.com/janet-lang/janet
synced 2025-10-30 07:03:02 +00:00
Merge branch 'master' into compile-opt
This commit is contained in:
@@ -664,6 +664,8 @@
|
||||
@[]) "peg if not")
|
||||
|
||||
(defn test [name peg input expected]
|
||||
(assert-no-error "compile peg" (peg/compile peg))
|
||||
(assert-no-error "marshal/unmarshal peg" (-> peg marshal unmarshal))
|
||||
(assert (deep= (peg/match peg input) expected) name))
|
||||
|
||||
(test "sub: matches the same input twice"
|
||||
@@ -756,5 +758,19 @@
|
||||
"a,b,c"
|
||||
@["a" "b" "c"])
|
||||
|
||||
(test "nth 1"
|
||||
~{:prefix (number :d+ nil :n)
|
||||
:word '(lenprefix (-> :n) :w)
|
||||
:main (some (nth 1 (* :prefix ":" :word)))}
|
||||
"5:apple6:banana6:cherry"
|
||||
@["apple" "banana" "cherry"])
|
||||
|
||||
(test "only-tags 1"
|
||||
~{:prefix (number :d+ nil :n)
|
||||
:word (capture (lenprefix (-> :n) :w) :W)
|
||||
:main (some (* (only-tags (* :prefix ":" :word)) (-> :W)))}
|
||||
"5:apple6:banana6:cherry"
|
||||
@["apple" "banana" "cherry"])
|
||||
|
||||
(end-suite)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user