1 ;;;; This file is for testing external-format functionality, using
2 ;;;; test machinery which might have side effects (e.g. executing
3 ;;;; DEFUN, writing files). Note that the tests here reach into
4 ;;;; unexported functionality, and should not be used as a guide for
7 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; While most of SBCL is derived from the CMU CL system, the test
11 ;;;; files (like this one) were written from scratch after the fork
14 ;;;; This software is in the public domain and is provided with
15 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
16 ;;;; more information.
18 (defmacro do-external-formats ((xf &optional result) &body body)
20 `(dolist (,nxf sb-impl::*external-formats* ,result)
21 (let ((,xf (first (first ,nxf))))
24 (do-external-formats (xf)
25 (with-open-file (s "/dev/null" :direction :input :external-format xf)
26 (assert (eq (read-char s nil s) s))))
28 (let ((s (open "external-format-test.lisp" :direction :output
29 :if-exists :supersede :external-format :latin-1)))
32 (write-string ";;; ABCD" s)
33 (write-char (code-char 233) s)
36 (compile-file "external-format-test.lisp" :external-format :utf-8))
38 (let ((p (probe-file (compile-file-pathname "external-format-test.lisp"))))
42 (sb-ext:quit :unix-status 104)