1.0.29.1: fix FILL
[sbcl.git] / tests / external-format.impure.lisp
index 405fea1..3a96fb7 100644 (file)
     (values)))
 (delete-file *test-path*)
 
+;;; We used to call STREAM-EXTERNAL-FORMAT on the stream in the error
+;;; when printing a coding error, but that didn't work if the stream
+;;; was closed by the time the error was printed.  See sbcl-devel
+;;; "Subject: Printing coding errors for closed streams" by Zach Beane
+;;; on 2008-10-16 for more info.
+(with-test (:name (:character-coding-error-stream-external-format))
+  (flet ((first-file-character ()
+           (with-open-file (stream *test-path* :external-format :utf-8)
+             (read-char stream))))
+    (with-open-file (stream *test-path*
+                            :direction :output
+                            :if-exists :supersede
+                            :element-type '(unsigned-byte 8))
+      (write-byte 192 stream))
+    (princ-to-string (nth-value 1 (ignore-errors (first-file-character))))))
+(delete-file *test-path*)
+
 ;;; External format support in SB-ALIEN
 
 (with-test (:name (:sb-alien :vanilla))