summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-04-27 16:26:26 +0200
committerLudovic Courtès <ludo@gnu.org>2011-04-27 16:28:32 +0200
commitd84783a80c186b0b13e3aeb206384bb198bf41e6 (patch)
tree9711bbb88156d06a44cd9d106ab38cd5e554f70c
parent9a201881e67780f08fd398538100d4cdb4095321 (diff)
downloadguile-d84783a80c186b0b13e3aeb206384bb198bf41e6.tar.gz
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.
-rw-r--r--test-suite/tests/ports.test12
1 files changed, 11 insertions, 1 deletions
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 ()