0.8.21.16:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 4 Apr 2005 09:49:43 +0000 (09:49 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 4 Apr 2005 09:49:43 +0000 (09:49 +0000)
Merge Teemu Kalvas' latest patch;
... add a terribly minimal test file for external-format issues

src/code/fd-stream.lisp
tests/external-format.impure.lisp [new file with mode: 0644]
version.lisp-expr

index 9dd5f06..89bc127 100644 (file)
                      nil))
              (setf (fd-stream-ibuf-head stream) head)
              (when (and decode-break-reason
-                        (= head head-start)
-                        (stream-decoding-error-and-handle
-                         stream decode-break-reason))
-               (if eof-error-p
-                   (error 'end-of-file :stream stream)
-                   (return-from ,in-function total-copied)))
+                        (= head head-start))
+               (when (stream-decoding-error-and-handle
+                      stream decode-break-reason)
+                 (if eof-error-p
+                     (error 'end-of-file :stream stream)
+                     (return-from ,in-function total-copied)))
+               (setf head (fd-stream-ibuf-head stream))
+               (setf tail (fd-stream-ibuf-tail stream)))
              (when (plusp total-copied)
                (return-from ,in-function total-copied)))
            (setf (fd-stream-ibuf-head stream) head)
diff --git a/tests/external-format.impure.lisp b/tests/external-format.impure.lisp
new file mode 100644 (file)
index 0000000..9673578
--- /dev/null
@@ -0,0 +1,43 @@
+;;;; This file is for testing external-format functionality, using
+;;;; test machinery which might have side effects (e.g.  executing
+;;;; DEFUN, writing files).  Note that the tests here reach into
+;;;; unexported functionality, and should not be used as a guide for
+;;;; users.
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;; 
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(defmacro do-external-formats ((xf &optional result) &body body)
+  (let ((nxf (gensym)))
+    `(dolist (,nxf sb-impl::*external-formats* ,result)
+       (let ((,xf (first (first ,nxf))))
+        ,@body))))
+
+(do-external-formats (xf)
+  (with-open-file (s "/dev/null" :direction :input :external-format xf)
+    (assert (eq (read-char s nil s) s))))
+
+(let ((s (open "external-format-test.lisp" :direction :output
+              :if-exists :supersede :external-format :latin-1)))
+  (unwind-protect
+       (progn
+        (write-string ";;; ABCD" s)
+        (write-char (code-char 233) s)
+        (terpri s)
+        (close s)
+        (compile-file "external-format-test.lisp" :external-format :utf-8))
+    (delete-file s)
+    (let ((p (probe-file (compile-file-pathname "external-format-test.lisp"))))
+      (when p
+       (delete-file p)))))
+
+(sb-ext:quit :unix-status 104)
+    
\ No newline at end of file
index 42f8404..3188f64 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.21.15"
+"0.8.21.16"