X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fbivalent-stream.impure.lisp;fp=tests%2Fbivalent-stream.impure.lisp;h=faf21e323cfbe29d2af019150c195c4ab3299319;hb=56ee3433c3c2258e48fb799719688f29c71e05d4;hp=0000000000000000000000000000000000000000;hpb=b41f8c974ccfba8a59ec2a6af843e8869e14be5f;p=sbcl.git diff --git a/tests/bivalent-stream.impure.lisp b/tests/bivalent-stream.impure.lisp new file mode 100644 index 0000000..faf21e3 --- /dev/null +++ b/tests/bivalent-stream.impure.lisp @@ -0,0 +1,37 @@ +;;;; This file is for testing bivalent stream functionality, using +;;;; test machinery which might have side effects (e.g. executing +;;;; DEFUN, writing files). Note that the tests here might 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. + +;;; Test character decode restarts. +(with-open-file (s "bivalent-stream-test.txt" :direction :output + :if-exists :supersede + :element-type :default :external-format :utf-8) + (write-byte 65 s) + (write-char #\B s) + (write-byte #xe0 s) + (write-char #\C s)) + +(with-open-file (s "bivalent-stream-test.txt" :direction :input + :element-type :default + :external-format :utf-8) + (assert (eql (read-char s nil s) #\A)) + (assert (eql (read-byte s nil s) 66)) + (assert (eql (read-byte s nil s) #xe0)) + (assert (eql (read-char s nil s) #\C))) + +(delete-file "bivalent-stream-test.txt") + +(sb-ext:quit :unix-status 104)