diff options
Diffstat (limited to 'test-suite/tests/encoding-utf8.test')
-rw-r--r-- | test-suite/tests/encoding-utf8.test | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test-suite/tests/encoding-utf8.test b/test-suite/tests/encoding-utf8.test index a2613f1d7..d2bdb6901 100644 --- a/test-suite/tests/encoding-utf8.test +++ b/test-suite/tests/encoding-utf8.test @@ -32,6 +32,88 @@ (if (defined? 'setlocale) (set! oldlocale (setlocale LC_ALL ""))) +(define ascii-a (integer->char 65)) ; LATIN CAPITAL LETTER A +(define a-acute (integer->char #x00c1)) ; LATIN CAPITAL LETTER A WITH ACUTE +(define alpha (integer->char #x03b1)) ; GREEK SMALL LETTER ALPHA +(define cherokee-a (integer->char #x13a0)) ; CHEROKEE LETTER A + +(with-test-prefix "characters" + (pass-if "input A" + (char=? ascii-a #\A)) + + (pass-if "input A acute" + (char=? a-acute #\Á)) + + (pass-if "input alpha" + (char=? alpha #\α)) + + (pass-if "input Cherokee A" + (char=? cherokee-a #\Ꭰ)) + + (pass-if "display A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'substitute) + (display ascii-a pt) + (string=? "A" + (get-output-string pt)))) + + (pass-if "display A acute" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'substitute) + (display a-acute pt) + (string=? "Á" + (get-output-string pt)))) + + (pass-if "display alpha" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'substitute) + (display alpha pt) + (string-ci=? "α" + (get-output-string pt)))) + + (pass-if "display Cherokee A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'substitute) + (display cherokee-a pt) + (string-ci=? "Ꭰ" + (get-output-string pt)))) + + (pass-if "write A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'escape) + (write ascii-a pt) + (string=? "#\\A" + (get-output-string pt)))) + + (pass-if "write A acute" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'escape) + (write a-acute pt) + (string=? "#\\Á" + (get-output-string pt)))) + + (pass-if "write alpha" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'escape) + (write alpha pt) + (string=? "#\\α" + (get-output-string pt)))) + + (pass-if "write Cherokee A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'escape) + (write cherokee-a pt) + (string=? "#\\Ꭰ" + (get-output-string pt))))) + (define s1 "última") (define s2 "cédula") (define s3 "años") |