diff options
author | Michael Gran <spk121@yahoo.com> | 2009-09-07 18:50:39 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-09-07 19:12:40 -0700 |
commit | 0d05ae7c4b1eddf6257f99f44eaf5cb7b11191be (patch) | |
tree | 4f34bd68547e7214e28496edeba6466e34c3c624 /test-suite/tests/regexp.test | |
parent | 7519234547acd3ced5cbe265f0bf1fcd6d6cda06 (diff) | |
download | guile-0d05ae7c4b1eddf6257f99f44eaf5cb7b11191be.tar.gz |
8-bit locale needed for 8-bit regexp tests
Since the regex library expects 8-bit clean characters and
an 8-bit locale, tests of 8-bit characters need to occur within
the context of an 8-bit locale.
* test-suite/tests/regexp.test (regexp-quote tests): wrap them in an
ISO-8859-1 locale
Diffstat (limited to 'test-suite/tests/regexp.test')
-rw-r--r-- | test-suite/tests/regexp.test | 99 |
1 files changed, 50 insertions, 49 deletions
diff --git a/test-suite/tests/regexp.test b/test-suite/tests/regexp.test index 730839970..eac652784 100644 --- a/test-suite/tests/regexp.test +++ b/test-suite/tests/regexp.test @@ -132,55 +132,56 @@ (with-test-prefix "regexp-quote" - (pass-if-exception "no args" exception:wrong-num-args - (regexp-quote)) - - (pass-if-exception "bad string arg" exception:wrong-type-arg - (regexp-quote 'blah)) - - (let ((lst `((regexp/basic ,regexp/basic) - (regexp/extended ,regexp/extended))) - ;; string of all characters, except #\nul which doesn't work because - ;; it's the usual end-of-string for the underlying C regexec() - (allchars (list->string (map integer->char - (cdr (iota char-code-limit)))))) - (for-each - (lambda (elem) - (let ((name (car elem)) - (flag (cadr elem))) - - (with-test-prefix name - - ;; try on each individual character, except #\nul - (do ((i 1 (1+ i))) - ((>= i char-code-limit)) - (let* ((c (integer->char i)) - (s (string c)) - (q (regexp-quote s))) - (pass-if (list "char" i c s q) - (let ((m (regexp-exec (make-regexp q flag) s))) - (and (= 0 (match:start m)) - (= 1 (match:end m))))))) - - ;; try on pattern "aX" where X is each character, except #\nul - ;; this exposes things like "?" which are special only when they - ;; follow a pattern to repeat or whatever ("a" in this case) - (do ((i 1 (1+ i))) - ((>= i char-code-limit)) - (let* ((c (integer->char i)) - (s (string #\a c)) - (q (regexp-quote s))) - (pass-if (list "string \"aX\"" i c s q) - (let ((m (regexp-exec (make-regexp q flag) s))) - (and (= 0 (match:start m)) - (= 2 (match:end m))))))) - - (pass-if "string of all chars" - (let ((m (regexp-exec (make-regexp (regexp-quote allchars) - flag) allchars))) - (and (= 0 (match:start m)) - (= (string-length allchars) (match:end m)))))))) - lst))) + (with-locale "en_US.iso88591" + (pass-if-exception "no args" exception:wrong-num-args + (regexp-quote)) + + (pass-if-exception "bad string arg" exception:wrong-type-arg + (regexp-quote 'blah)) + + (let ((lst `((regexp/basic ,regexp/basic) + (regexp/extended ,regexp/extended))) + ;; string of all characters, except #\nul which doesn't work because + ;; it's the usual end-of-string for the underlying C regexec() + (allchars (list->string (map integer->char + (cdr (iota char-code-limit)))))) + (for-each + (lambda (elem) + (let ((name (car elem)) + (flag (cadr elem))) + + (with-test-prefix name + + ;; try on each individual character, except #\nul + (do ((i 1 (1+ i))) + ((>= i char-code-limit)) + (let* ((c (integer->char i)) + (s (string c)) + (q (regexp-quote s))) + (pass-if (list "char" i (format #f "~s ~s ~s" c s q)) + (let ((m (regexp-exec (make-regexp q flag) s))) + (and (= 0 (match:start m)) + (= 1 (match:end m))))))) + + ;; try on pattern "aX" where X is each character, except #\nul + ;; this exposes things like "?" which are special only when they + ;; follow a pattern to repeat or whatever ("a" in this case) + (do ((i 1 (1+ i))) + ((>= i char-code-limit)) + (let* ((c (integer->char i)) + (s (string #\a c)) + (q (regexp-quote s))) + (pass-if (list "string \"aX\"" i (format #f "~s ~s ~s" c s q)) + (let ((m (regexp-exec (make-regexp q flag) s))) + (and (= 0 (match:start m)) + (= 2 (match:end m))))))) + + (pass-if "string of all chars" + (let ((m (regexp-exec (make-regexp (regexp-quote allchars) + flag) allchars))) + (and (= 0 (match:start m)) + (= (string-length allchars) (match:end m)))))))) + lst)))) ;;; ;;; regexp-substitute |