Raymond Toy pushed to branch issue-140-stream-element-type-two-way-stream at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/stream.lisp
    ... ... @@ -304,11 +304,7 @@
    304 304
            ;; Not defined by CLHS.  What should happen if
    
    305 305
            ;; (synonym-stream-symbol stream) is unbound?
    
    306 306
            (stream-external-format
    
    307
    -	(symbol-value (synonym-stream-symbol stream))))
    
    308
    -      (two-way-stream
    
    309
    -       ;; Not defined by CLHS, but use default for backward
    
    310
    -       ;; compatibility.
    
    311
    -       :default))
    
    307
    +	(symbol-value (synonym-stream-symbol stream)))))
    
    312 308
         ;; fundamental-stream
    
    313 309
         :default))
    
    314 310
     
    

  • tests/issues.lisp
    ... ... @@ -747,9 +747,7 @@
    747 747
       
    
    748 748
     ;;; Test stream-external-format for various types of streams.
    
    749 749
     
    
    750
    -;; Test two-way-stream where both streams have the same external
    
    751
    -;; format.
    
    752
    -(define-test issue.140.two-way-stream-same
    
    750
    +(define-test issue.140.two-way-stream
    
    753 751
         (:tag :issues)
    
    754 752
       (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
    
    755 753
     		      :direction :input
    
    ... ... @@ -759,21 +757,8 @@
    759 757
     			 :external-format :utf-8
    
    760 758
     			 :if-exists :supersede)
    
    761 759
           (let ((two-way-stream (make-two-way-stream in out)))
    
    762
    -	(assert-equal :default (stream-external-format two-way-stream))))))
    
    763
    -
    
    764
    -;; Test two-way-stream where the two streams have the different
    
    765
    -;; external formats.
    
    766
    -(define-test issue.140.two-way-stream-diff
    
    767
    -    (:tag :issues)
    
    768
    -  (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
    
    769
    -		      :direction :input
    
    770
    -		      :external-format :iso8859-1)
    
    771
    -    (with-open-file (out "/tmp/output.tst"
    
    772
    -			 :direction :output
    
    773
    -			 :external-format :utf-8
    
    774
    -			 :if-exists :supersede)
    
    775
    -      (let ((two-way-stream (make-two-way-stream in out)))
    
    776
    -	(assert-equal :default (stream-external-format two-way-stream))))))
    
    760
    +	(assert-error 'type-error
    
    761
    +		      (stream-external-format two-way-stream))))))
    
    777 762
     
    
    778 763
     ;; Test synonym-stream returns the format of the underlying stream.
    
    779 764
     (define-test issue.140.synonym-stream
    
    ... ... @@ -785,6 +770,29 @@
    785 770
           (setf syn s)
    
    786 771
           (assert-equal :iso8859-1 (stream-external-format syn)))))
    
    787 772
     
    
    773
    +(define-test issue.140.broadcast-stream
    
    774
    +    (:tag :issues)
    
    775
    +  ;; Create 3 output streams.  The exact external formats aren't
    
    776
    +  ;; really important here as long as they're different for each file
    
    777
    +  ;; so we can tell if we got the right answer.
    
    778
    +  (with-open-file (s1 "/tmp/broad-1"
    
    779
    +		      :direction :output
    
    780
    +		      :if-exists :supersede
    
    781
    +		      :external-format :latin1)
    
    782
    +    (with-open-file (s2 "/tmp/broad-2" 
    
    783
    +			:direction :output
    
    784
    +			:if-exists :supersede
    
    785
    +			:external-format :utf-8)
    
    786
    +      (with-open-file (s3 "/tmp/broad-3" 
    
    787
    +			  :direction :output
    
    788
    +			  :if-exists :supersede
    
    789
    +			  :external-format :utf-16)
    
    790
    +	;; The format must be the value from the last stream.
    
    791
    +	(assert-equal :utf-16
    
    792
    +		      (stream-external-format
    
    793
    +		       (make-broadcast-stream s1 s2 s3)))))))
    
    794
    +
    
    795
    +
    
    788 796
     (define-test issue.150
    
    789 797
         (:tag :issues)
    
    790 798
       (let ((ext:*gc-verbose* nil)