lispci / fiveam

Common Lisp regression testing framework
BSD 3-Clause "New" or "Revised" License
186 stars 33 forks source link

Capturing output by redirecting standard output stream to local stream results in prematurely closed-flame streams #95

Open afranson opened 1 year ago

afranson commented 1 year ago

MWE:

(5am:test foo-bar
  (5am:is (= 5 5))
  (5am:is (string= "
\"print test\" " (with-open-stream (s (make-string-output-stream))
             (setf *standard-output* s)
             (print "print test")
             (get-output-stream-string s)))))

(5am:run! 'foo-bar)

Running the second test case outside the 5am framework results in 'T'. Running as shown above via 5am:run! results in

#<SB-IMPL::STRING-OUTPUT-STREAM {101B27A743}> is closed
   [Condition of type SB-INT:CLOSED-STREAM-ERROR]

with

(IT.BESE.FIVEAM::ADD-RESULT IT.BESE.FIVEAM::UNEXPECTED-TEST-FAILURE :TEST-EXPR NIL :TEST-CASE #<IT.BESE.FIVEAM::TEST-CASE FOO-BAR {101B068893}> :REASON "Unexpected Error: #<SB-INT:CLOSED-STREAM-ERROR ..

and

((FLET "H1" :IN IT.BESE.FIVEAM::RUN-TEST-LAMBDA) #<SB-INT:CLOSED-STREAM-ERROR {101B27A8D3}>)

further down.