1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

Add a couple more Unicode I/O tests.

* test-suite/tests/ports.test ("string ports")["%default-port-encoding
  is honored"]: Make sure `(port-encoding p)' is as expected.
  ["peek-char [utf-16]"]: New test.
This commit is contained in:
Ludovic Courtès 2011-04-27 16:26:26 +02:00
parent 9a201881e6
commit d84783a80c

View file

@ -391,7 +391,8 @@
(with-fluids ((%default-port-encoding e))
(call-with-output-string
(lambda (p)
(display (port-encoding p) p)))))
(and (string=? e (port-encoding p))
(display (port-encoding p) p))))))
encodings)
encodings)))
@ -462,6 +463,15 @@
(= (port-line p) 0)
(= (port-column p) 0))))
(pass-if "peek-char [utf-16]"
(let ((p (with-fluids ((%default-port-encoding "UTF-16BE"))
(open-input-string "안녕하세요"))))
(and (char=? (peek-char p) #\안)
(char=? (peek-char p) #\안)
(char=? (peek-char p) #\안)
(= (port-line p) 0)
(= (port-column p) 0))))
;; Mini DSL to test decoding error handling.
(letrec-syntax ((decoding-error?
(syntax-rules ()