From: Christophe R. <cr...@us...> - 2009-11-11 17:21:14
|
Update of /cvsroot/sbcl/sbcl/tests In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30896/tests Modified Files: external-format.impure.lisp Log Message: 1.0.32.20: bug fixes in unibyte external formats * handling undefined codepoints: There's a difference between "unassigned codepoint", represented as (<code> nil), and "codepoint mapping to character with that codepoint", represented by the absence of an entry in the exceptions list. Simply testing for trueness of (cadr (assoc <code> exceptions)) isn't good enough; test for trueness of (cdr (assoc ...)) and use the car if so. * undefined codepoints as the first exception: If the first exception to code<->byte is an undefined character, as for example in iso-8859-8, the lowest-code exception was computed wrongly, leading to incorrect encoding. Index: external-format.impure.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/tests/external-format.impure.lisp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- external-format.impure.lisp 11 Nov 2009 13:21:37 -0000 1.22 +++ external-format.impure.lisp 11 Nov 2009 17:21:05 -0000 1.23 @@ -366,4 +366,13 @@ (assert (or (= i (char-code #\?)) (> i 127)))) (t (assert (and (not (= i (char-code #\?))) (< i 128))))))))) +(with-test (:name (:unibyte-invalid-codepoints :cp857)) + (dotimes (i 256) + (with-open-file (s *test-path* :direction :output :if-exists :supersede :element-type '(unsigned-byte 8)) + (write-byte i s)) + (with-open-file (s *test-path* :external-format :cp857) + (handler-case (read-char s) + (error () (assert (member i '(#xd5 #xe7 #xf2)))) + (:no-error (char) (assert (not (member i '(#xd5 #xe7 #xf2))))))))) + ;;;; success |