From 5c730d87d80745450fa40f039b474555e0c168c9 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Mon, 28 Apr 2014 16:43:52 -0400
Subject: [PATCH] Add test for :close-stream variant of with-temporary-file.

---
 test/test-utilities.script | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/test-utilities.script b/test/test-utilities.script
index f469df4c4..9e2217e4d 100644
--- a/test/test-utilities.script
+++ b/test/test-utilities.script
@@ -305,6 +305,18 @@
   (assert-equal (read-file-lines pn) '("Hello, World"))
   (delete-file pn))
 
+(assert
+ (not (probe-file
+       (let ((s 'outer-s))
+         (with-temporary-file (:stream s :pathname p :direction :io :prefix "LEP")
+           (assert (open-stream-p s))
+           (DBG :wsp s p (probe-file p))
+           (println "Same thing with :close-stream" s)
+           :close-stream
+           (assert-equal s 'outer-s) ;; the stream s (1) has been closed and (2) is no longer in scope.
+           (assert-equal (read-file-lines p) '("Same thing with :close-stream"))
+           p)))))
+
 (DBG :ensure-gethash)
 (let ((h (make-hash-table :test 'equal)))
   (assert-equal (multiple-value-list (gethash 1 h 2)) '(2 nil))
-- 
GitLab