From d84783a80c186b0b13e3aeb206384bb198bf41e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 27 Apr 2011 16:26:26 +0200 Subject: [PATCH] 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. --- test-suite/tests/ports.test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test index 1f0e9b0cf..c9337248a 100644 --- a/test-suite/tests/ports.test +++ b/test-suite/tests/ports.test @@ -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 ()