diff options
Diffstat (limited to 'test-suite/tests/encoding-iso88591.test')
-rw-r--r-- | test-suite/tests/encoding-iso88591.test | 82 |
1 files changed, 61 insertions, 21 deletions
diff --git a/test-suite/tests/encoding-iso88591.test b/test-suite/tests/encoding-iso88591.test index d4de5e534..b4d48a6f3 100644 --- a/test-suite/tests/encoding-iso88591.test +++ b/test-suite/tests/encoding-iso88591.test @@ -33,6 +33,67 @@ (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 "display A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "ISO-8859-1") + (set-port-conversion-strategy! pt 'escape) + (display ascii-a pt) + (string=? "A" + (get-output-string pt)))) + + (pass-if "display A acute" + (let ((pt (open-output-string))) + (set-port-encoding! pt "ISO-8859-1") + (set-port-conversion-strategy! pt 'escape) + (display a-acute pt) + (string=? "Á" + (get-output-string pt)))) + + (pass-if "display alpha" + (let ((pt (open-output-string))) + (set-port-encoding! pt "ISO-8859-1") + (set-port-conversion-strategy! pt 'escape) + (display alpha pt) + (string-ci=? "\\u03b1" + (get-output-string pt)))) + + (pass-if "display Cherokee a" + (let ((pt (open-output-string))) + (set-port-encoding! pt "ISO-8859-1") + (set-port-conversion-strategy! pt 'escape) + (display cherokee-a pt) + (string-ci=? "\\u13a0" + (get-output-string pt)))) + + (pass-if "write A" + (let ((pt (open-output-string))) + (set-port-encoding! pt "ISO-8859-1") + (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 "ISO-8859-1") + (set-port-conversion-strategy! pt 'escape) + (write a-acute pt) + (string=? "#\\Á" + (get-output-string pt))))) + + (define s1 "última") (define s2 "cédula") (define s3 "años") @@ -84,27 +145,6 @@ (list= eqv? (string->list s4) (list #\¿ #\C #\ó #\m #\o #\?)))) -;; Check that the output is in ISO-8859-1 encoding -(with-test-prefix "display" - - (pass-if "s1" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-1") - (display s1 pt) - (list= eqv? - (list #xfa #x6c #x74 #x69 #x6d #x61) - (u8vector->list - (get-output-locale-u8vector pt))))) - - (pass-if "s2" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-1") - (display s2 pt) - (list= eqv? - (list #x63 #xe9 #x64 #x75 #x6c #x61) - (u8vector->list - (get-output-locale-u8vector pt)))))) - (with-test-prefix "symbols == strings" (pass-if "última" |