... |
... |
@@ -670,9 +670,42 @@ |
670
|
670
|
(err (relerr value answer)))
|
671
|
671
|
(assert-true (<= err eps) base err eps)))))))
|
672
|
672
|
|
673
|
|
-(define-test issue.140
|
|
673
|
+;;; Test stream-external-format for various types of streams.
|
|
674
|
+
|
|
675
|
+;; Test two-way-stream where both streams have the same external
|
|
676
|
+;; format.
|
|
677
|
+(define-test issue.140.1
|
|
678
|
+ (:tag :issues)
|
|
679
|
+ (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
|
680
|
+ :direction :input
|
|
681
|
+ :external-format :utf-8)
|
|
682
|
+ (with-open-file (out "/tmp/output.tst"
|
|
683
|
+ :direction :output
|
|
684
|
+ :external-format :utf-8
|
|
685
|
+ :if-exists :supersede)
|
|
686
|
+ (let ((two-way-stream (make-two-way-stream in out)))
|
|
687
|
+ (assert-equal :utf-8 (stream-external-format two-way-stream))))))
|
|
688
|
+
|
|
689
|
+;; Test two-way-stream where the two streams have the different
|
|
690
|
+;; external formats.
|
|
691
|
+(define-test issue.140.2
|
674
|
692
|
(:tag :issues)
|
675
|
|
- (with-output-to-string (out)
|
676
|
|
- (with-input-from-string (in "abc")
|
|
693
|
+ (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
|
694
|
+ :direction :input
|
|
695
|
+ :external-format :iso8859-1)
|
|
696
|
+ (with-open-file (out "/tmp/output.tst"
|
|
697
|
+ :direction :output
|
|
698
|
+ :external-format :utf-8
|
|
699
|
+ :if-exists :supersede)
|
677
|
700
|
(let ((two-way-stream (make-two-way-stream in out)))
|
678
|
|
- (assert-error 'type-error (stream-external-format two-way-stream)))))) |
|
701
|
+ (assert-equal :default (stream-external-format two-way-stream))))))
|
|
702
|
+
|
|
703
|
+;; Test synonym-stream returns the format of the underlying stream.
|
|
704
|
+(define-test issue.140.3
|
|
705
|
+ (:tag :issues)
|
|
706
|
+ (with-open-file (s (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
|
707
|
+ :direction :input
|
|
708
|
+ :external-format :iso8859-1)
|
|
709
|
+ (let ((syn (make-synonym-stream '*syn-stream*)))
|
|
710
|
+ (setf syn s)
|
|
711
|
+ (assert-equal :iso8859-1 (stream-external-format syn))))) |