diff options
author | Michael Gran <spk121@yahoo.com> | 2009-09-24 08:10:03 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-09-24 08:15:25 -0700 |
commit | bcccf04158bda5319776d45abd6cc748b794096b (patch) | |
tree | a8d1a16d44dfd5b87a4e035328a17405ea7548f4 /test-suite/tests/i18n.test | |
parent | 2c48e4d5b7c5f33f8ddc2ce9c381c9f51ce7b579 (diff) | |
download | guile-bcccf04158bda5319776d45abd6cc748b794096b.tar.gz |
Tests for locale-specific case conversion
* test-suite/tests/i18n.test: add tests for case conversion of Turkish
letters 'i' to verify that the language is being honored.
Diffstat (limited to 'test-suite/tests/i18n.test')
-rw-r--r-- | test-suite/tests/i18n.test | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/test-suite/tests/i18n.test b/test-suite/tests/i18n.test index 6bfdbc78f..4f11a8a90 100644 --- a/test-suite/tests/i18n.test +++ b/test-suite/tests/i18n.test @@ -85,6 +85,9 @@ (define %french-utf8-locale-name "fr_FR.UTF-8") +(define %turkish-utf8-locale-name + "tr_TR.UTF-8") + (define %french-locale (false-if-exception (make-locale (list LC_CTYPE LC_COLLATE LC_NUMERIC LC_TIME) @@ -95,6 +98,11 @@ (make-locale (list LC_CTYPE LC_COLLATE LC_NUMERIC LC_TIME) %french-utf8-locale-name))) +(define %turkish-utf8-locale + (false-if-exception + (make-locale LC_ALL + %turkish-utf8-locale-name))) + (define (under-locale-or-unresolved locale thunk) ;; On non-GNU systems, an exception may be raised only when the locale is ;; actually used rather than at `make-locale'-time. Thus, we must guard @@ -113,6 +121,8 @@ (define (under-french-utf8-locale-or-unresolved thunk) (under-locale-or-unresolved %french-utf8-locale thunk)) +(define (under-turkish-utf8-locale-or-unresolved thunk) + (under-locale-or-unresolved %turkish-utf8-locale thunk)) (with-test-prefix "text collation (French)" @@ -190,7 +200,38 @@ (pass-if "char-locale-upcase" (and (eq? #\Z (char-locale-upcase #\z)) - (eq? #\Z (char-locale-upcase #\z (make-locale LC_ALL "C")))))) + (eq? #\Z (char-locale-upcase #\z (make-locale LC_ALL "C"))))) + + (pass-if "char-locale-upcase Turkish" + (under-turkish-utf8-locale-or-unresolved + (lambda () + (eq? #\İ (char-locale-upcase #\i %turkish-utf8-locale))))) + + (pass-if "char-locale-downcase Turkish" + (under-turkish-utf8-locale-or-unresolved + (lambda () + (eq? #\i (char-locale-downcase #\İ %turkish-utf8-locale)))))) + + +(with-test-prefix "string mapping" + + (pass-if "string-locale-downcase" + (and (string=? "a" (string-locale-downcase "A")) + (string=? "a" (string-locale-downcase "A" (make-locale LC_ALL "C"))))) + + (pass-if "string-locale-upcase" + (and (string=? "Z" (string-locale-upcase "z")) + (string=? "Z" (string-locale-upcase "z" (make-locale LC_ALL "C"))))) + + (pass-if "string-locale-upcase Turkish" + (under-turkish-utf8-locale-or-unresolved + (lambda () + (string=? "İI" (string-locale-upcase "iı" %turkish-utf8-locale))))) + + (pass-if "string-locale-downcase Turkish" + (under-turkish-utf8-locale-or-unresolved + (lambda () + (string=? "iı" (string-locale-downcase "İI" %turkish-utf8-locale)))))) (with-test-prefix "number parsing" |