1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-18 22:54:49 +00:00

Add test for longstring matcher using backmatches.

This commit is contained in:
Calvin Rose 2019-08-24 19:02:55 -04:00
parent 711fe64a51
commit 133ad0d355

View File

@ -378,6 +378,16 @@
(check-match backmatcher-2 (string (string/repeat "x" 10000) "y") false)
(check-match backmatcher-2 (string (string/repeat "x" 10000) "y" (string/repeat "x" 10000)) true)
(def longstring-2 '(* '(some "`") (some (if-not (backmatch) 1)) (backmatch) -1))
(check-match longstring-2 "`john" false)
(check-match longstring-2 "abc" false)
(check-match longstring-2 "` `" true)
(check-match longstring-2 "` `" true)
(check-match longstring-2 "`` ``" true)
(check-match longstring-2 "``` `` ```" true)
(check-match longstring-2 "`` ```" false)
# Optional
(check-match '(* (opt "hi") -1) "" true)