X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fexternal-format.impure.lisp;h=c86b6ef2fb0070813c897d53dde46116cbb6371b;hb=5e92e9ed61903658015c2a75c79a32ad41dbd29d;hp=d4e9cbd0dc57370dc2aae60ab10861ad97a136bd;hpb=4898ef32c639b1c7f4ee13a5ba566ce6debd03e6;p=sbcl.git diff --git a/tests/external-format.impure.lisp b/tests/external-format.impure.lisp index d4e9cbd..c86b6ef 100644 --- a/tests/external-format.impure.lisp +++ b/tests/external-format.impure.lisp @@ -15,9 +15,6 @@ ;;;; absolutely no warranty. See the COPYING and CREDITS files for ;;;; more information. -#-sb-unicode -(sb-ext:quit :unix-status 104) - (defmacro do-external-formats ((xf &optional result) &body body) (let ((nxf (gensym))) `(dolist (,nxf sb-impl::*external-formats* ,result) @@ -40,6 +37,12 @@ (loop for character across standard-characters do (assert (eql (read-char s) character)))))) +(delete-file "external-format-test.txt") +#-sb-unicode +(progn + (test-util:report-test-status) + (sb-ext:quit :unix-status 104)) + ;;; Test UTF-8 writing and reading of 1, 2, 3 and 4 octet characters with ;;; all possible offsets. Tests for buffer edge bugs. fd-stream buffers are ;;; 4096 wide. @@ -134,6 +137,27 @@ (when p (delete-file p))))) -(delete-file "external-format-test.txt") + +;;;; KOI8-R external format +(with-open-file (s "external-format-test.txt" :direction :output + :if-exists :supersede :external-format :koi8-r) + (write-char (code-char #xB0) s) + (assert (eq + (handler-case + (progn + (write-char (code-char #xBAAD) s) + :bad) + (sb-int:character-encoding-error () + :good)) + :good))) +(with-open-file (s "external-format-test.txt" :direction :input + :element-type '(unsigned-byte 8)) + (let ((byte (read-byte s))) + (assert (= (eval byte) #x9C)))) +(with-open-file (s "external-format-test.txt" :direction :input + :external-format :koi8-r) + (let ((char (read-char s))) + (assert (= (char-code (eval char)) #xB0)))) -(sb-ext:quit :unix-status 104) + +(delete-file "external-format-test.txt")