Always run at least the ASCII regexp tests.
authorLudovic Courtès <ludo@gnu.org>
Fri, 8 Oct 2010 07:46:39 +0000 (09:46 +0200)
committerLudovic Courtès <ludo@gnu.org>
Fri, 8 Oct 2010 13:25:56 +0000 (15:25 +0200)
* test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro.
  ("regexp-quote"): Use it instead of `with-latin1-locale'.

test-suite/tests/regexp.test

index a6844ca..efa0e7e 100644 (file)
 ;;; 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"
 
   (pass-if-exception "no args" exception:wrong-num-args
              (let* ((c (integer->char i))
                     (s (string c)))
                (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))
                          (m (regexp-exec (make-regexp q flag) s)))
                     (and (= 0 (match:start m))
                     (s (string #\a c))
                     (q (regexp-quote s)))
                (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)))
                     (and (= 0 (match:start m))
                          (= 2 (match:end m))))))))