mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 14:30:34 +02:00
Always run at least the ASCII regexp tests.
* test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro. ("regexp-quote"): Use it instead of `with-latin1-locale'.
This commit is contained in:
parent
aee24bac50
commit
8a954f3df5
1 changed files with 9 additions and 2 deletions
|
@ -138,6 +138,13 @@
|
||||||
;;; regexp-quote
|
;;; regexp-quote
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
(define-syntax with-ascii-or-latin1-locale
|
||||||
|
(syntax-rules ()
|
||||||
|
((_ chr body ...)
|
||||||
|
(if (> chr 127)
|
||||||
|
(with-latin1-locale body ...)
|
||||||
|
(begin body ...)))))
|
||||||
|
|
||||||
(with-test-prefix "regexp-quote"
|
(with-test-prefix "regexp-quote"
|
||||||
|
|
||||||
(pass-if-exception "no args" exception:wrong-num-args
|
(pass-if-exception "no args" exception:wrong-num-args
|
||||||
|
@ -165,7 +172,7 @@
|
||||||
(let* ((c (integer->char i))
|
(let* ((c (integer->char i))
|
||||||
(s (string c)))
|
(s (string c)))
|
||||||
(pass-if (list "char" i (format #f "~s ~s" c s))
|
(pass-if (list "char" i (format #f "~s ~s" c s))
|
||||||
(with-latin1-locale
|
(with-ascii-or-latin1-locale i
|
||||||
(let* ((q (regexp-quote s))
|
(let* ((q (regexp-quote s))
|
||||||
(m (regexp-exec (make-regexp q flag) s)))
|
(m (regexp-exec (make-regexp q flag) s)))
|
||||||
(and (= 0 (match:start m))
|
(and (= 0 (match:start m))
|
||||||
|
@ -180,7 +187,7 @@
|
||||||
(s (string #\a c))
|
(s (string #\a c))
|
||||||
(q (regexp-quote s)))
|
(q (regexp-quote s)))
|
||||||
(pass-if (list "string \"aX\"" i (format #f "~s ~s ~s" c s q))
|
(pass-if (list "string \"aX\"" i (format #f "~s ~s ~s" c s q))
|
||||||
(with-latin1-locale
|
(with-ascii-or-latin1-locale i
|
||||||
(let* ((m (regexp-exec (make-regexp q flag) s)))
|
(let* ((m (regexp-exec (make-regexp q flag) s)))
|
||||||
(and (= 0 (match:start m))
|
(and (= 0 (match:start m))
|
||||||
(= 2 (match:end m))))))))
|
(= 2 (match:end m))))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue