guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-132-g211e7


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-132-g211e71a
Date: Mon, 09 Jan 2012 22:16:24 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=211e71a18480309904f672bd8fb943a94f447c7c

The branch, stable-2.0 has been updated
       via  211e71a18480309904f672bd8fb943a94f447c7c (commit)
      from  67543d076175d000bc95b902be8ea71cd9b75e26 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 211e71a18480309904f672bd8fb943a94f447c7c
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jan 9 23:16:20 2012 +0100

    Make sure `regexp-quote' tests use Unicode-capable string ports.
    
    * test-suite/tests/regexp.test (with-unicode): New macro.
      ("regexp-quote"): Wrap all `regexp-quote' calls in it.  This fixes
      tests on machines where the default port encoding is US-ASCII.

-----------------------------------------------------------------------

Summary of changes:
 test-suite/tests/regexp.test |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/test-suite/tests/regexp.test b/test-suite/tests/regexp.test
index f405df4..8217a41 100644
--- a/test-suite/tests/regexp.test
+++ b/test-suite/tests/regexp.test
@@ -145,6 +145,14 @@
          (with-latin1-locale body ...)
          (begin body ...)))))
 
+;; Since `regexp-quote' uses string ports, and since it is used below
+;; with non-ASCII characters, these ports must be Unicode-capable.
+(define-syntax with-unicode
+  (syntax-rules ()
+    ((_ exp)
+     (with-fluids ((%default-port-encoding "UTF-8"))
+       exp))))
+
 (with-test-prefix "regexp-quote"
 
   (pass-if-exception "no args" exception:wrong-num-args
@@ -173,7 +181,7 @@
                     (s (string c)))
                (pass-if (list "char" i (format #f "~s ~s" c s))
                  (with-ascii-or-latin1-locale i
-                  (let* ((q (regexp-quote s))
+                  (let* ((q (with-unicode (regexp-quote s)))
                          (m (regexp-exec (make-regexp q flag) s)))
                     (and (= 0 (match:start m))
                          (= 1 (match:end m))))))))
@@ -185,7 +193,7 @@
               ((>= i char-code-limit))
              (let* ((c (integer->char i))
                     (s (string #\a c))
-                    (q (regexp-quote s)))
+                    (q (with-unicode (regexp-quote s))))
                (pass-if (list "string \"aX\"" i (format #f "~s ~s ~s" c s q))
                  (with-ascii-or-latin1-locale i
                  (let* ((m (regexp-exec (make-regexp q flag) s)))
@@ -194,7 +202,8 @@
 
           (pass-if "string of all chars"
              (with-latin1-locale
-               (let ((m (regexp-exec (make-regexp (regexp-quote allchars)
+               (let ((m (regexp-exec (make-regexp (with-unicode
+                                                   (regexp-quote allchars))
                                                   flag) allchars)))
                  (and (= 0 (match:start m))
                       (= (string-length allchars) (match:end m)))))))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]