more tests
This commit is contained in:
parent
1e6d6d0841
commit
43e5f6fb8c
|
@ -496,7 +496,13 @@
|
||||||
(match:substring (string-match (uncase (rx "foo"))
|
(match:substring (string-match (uncase (rx "foo"))
|
||||||
"FoO")))))
|
"FoO")))))
|
||||||
|
|
||||||
;; XXX no idea how to test simplify-regexp
|
(add-test! 'simplify-regexp-test 'pattern-matching
|
||||||
|
(lambda ()
|
||||||
|
(and (re-dsm? (rx (: (** 0 0 (submatch "apple"))
|
||||||
|
(submatch "bar"))))
|
||||||
|
(= 2
|
||||||
|
(re-dsm:tsm (rx (: (** 0 0 (submatch "apple"))
|
||||||
|
(submatch "bar"))))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -533,3 +539,59 @@
|
||||||
; (re-repeat 1 #f (re-string "Sz"))
|
; (re-repeat 1 #f (re-string "Sz"))
|
||||||
; (re-string "ilagyi")))))))
|
; (re-string "ilagyi")))))))
|
||||||
|
|
||||||
|
(add-test! 'char-classes+algebra-test 'pattern-matching
|
||||||
|
(lambda ()
|
||||||
|
(and (matches-same-signs? (rx (| lower-case upper-case))
|
||||||
|
(rx alphabetic))
|
||||||
|
(matches-same-signs? (rx (- alphabetic lower-case))
|
||||||
|
(rx upper-case))
|
||||||
|
(matches-same-signs? (rx (- alphabetic upper-case))
|
||||||
|
(rx lower-case))
|
||||||
|
(matches-same-signs? (rx (& upper-case alphanumeric))
|
||||||
|
(rx upper-case))
|
||||||
|
(matches-same-signs? (rx (| upper-case lower-case numeric))
|
||||||
|
(rx alphanumeric))
|
||||||
|
(matches-same-signs? (rx (~ (& alphanumeric lower-case)
|
||||||
|
graphic
|
||||||
|
(| upper-case numeric)))
|
||||||
|
(rx (- any
|
||||||
|
alphanumeric
|
||||||
|
graphic)))
|
||||||
|
(matches-same-signs? (rx (/ "azAZ09"))
|
||||||
|
(rx alphanumeric))
|
||||||
|
(matches-same-signs? (rx (~ (| (/ "az") (/ "AZ") (/ "09"))))
|
||||||
|
(rx (- any alphanumeric)))
|
||||||
|
(matches-same-signs? (rx (& (/ "az09")
|
||||||
|
(/ "AZ09")))
|
||||||
|
(rx numeric)))))
|
||||||
|
|
||||||
|
(add-test! 'different-ways-test 'pattern-matching
|
||||||
|
(lambda ()
|
||||||
|
(and (eq-match? (string-match (rx "abcde") "xxxabcdexxx")
|
||||||
|
(string-match (rx (: "a" "b" "c" "d" "e")) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "abcde") "xxxabcdexxx")
|
||||||
|
(string-match (rx (: "a" (: "b" (: "c" (: "d" "e"))))) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "abcde") "xxxabcdexxx")
|
||||||
|
(string-match (rx (: "ab" "c" (: "d" "e"))) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "abcde") "xxxabcdexxx")
|
||||||
|
(string-match (rx (: "a" "b" "cde")) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "abcde") "xxxabcdexxx")
|
||||||
|
(string-match (rx (: (: (: "a" "b") "c") (: "d" "e"))) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "xxx" (* alphabetic) "xxx") "xxxabcdexxx")
|
||||||
|
(string-match (rx (+ "x") "abcde" (+ "x")) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx (: "x" (+ "x") (* "x"))
|
||||||
|
(: (? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric)
|
||||||
|
(? alphanumeric))
|
||||||
|
"xxx")
|
||||||
|
"xxxabcdexxx")
|
||||||
|
(string-match (rx (: "xxx" (* (/ "ae")) (+ "x"))) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx "xxxabcdexxx") "xxxabcdexxx")
|
||||||
|
(string-match (rx (* alphanumeric)) "xxxabcdexxx"))
|
||||||
|
(eq-match? (string-match (rx (: "xxx" (: "abcde" "x" "xx"))) "xxxabcdexxx")
|
||||||
|
(string-match (rx (* (| (/ "ae") "x"))) "xxxabcdexxx")))))
|
||||||
|
|
Loading…
Reference in New Issue