/
test-irregex-pcre.scm
37 lines (26 loc) · 1.2 KB
/
test-irregex-pcre.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/local/bin/csi -script
(import (rename (chezscheme) (format sprintf)
(call-with-string-output-port call-with-output-string))
(rename (srfi :64) (test-equal test))
(test-utils)
(irregex)
(matchable))
;; (use test extras utils)
;; (load "irregex.scm")
(test-begin "test-irregex-pcre")
(test-assert (irregex-search "\\x41," "A,"))
(test-assert (irregex-search "\\x{0041}" "A,"))
(test-assert (irregex-search "<[[:alpha:]]+>" "<abc>"))
(test-assert (not (irregex-search "<[[:alpha:]]+>" "<ab7c>")))
(test-assert (irregex-search "<[[^:alpha:]]+>" "<123>"))
(test-assert (not (irregex-search "<[[^:alpha:]]+>" "<12a3>")))
(test-error (irregex-search "<[[=alpha=]]+>" "<abc>"))
(test-error (irregex-search "<[[.alpha.]]+>" "<abc>"))
(test-assert (irregex-match "\\Q.*\\+" ".*\\+"))
(test-assert (irregex-match "\\Q.*\\+\\E" ".*\\+"))
(test-assert (not (irregex-match "\\Q.*\\+\\E" "x*\\+")))
(test-assert (irregex-match "\\Q.*\\" ".*\\"))
;;;; not added until perl 5.10 - implementation is too ugly and this
;;;; is too silly of a feature to keep
;; (test-assert (irregex-search "(sens|respons)e and (?1)ibility" "sense and responsibility"))
(test-end "test-irregex-pcre")