mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-04-27 19:50:44 -07:00
tests: improve with-temporary-file macro
This commit is contained in:
parent
17bce26704
commit
cc70b9feab
1 changed files with 6 additions and 7 deletions
|
|
@ -127,11 +127,10 @@ as a second value."
|
|||
(setf compiled-file (compile-file ,filename ,@compiler-args))))))
|
||||
(values compiled-file output))))
|
||||
|
||||
(defmacro with-temporary-file ((var string) &body body)
|
||||
(defmacro with-temporary-file ((var string &rest args) &body body)
|
||||
(ext:with-unique-names (stream)
|
||||
(ext:once-only (string)
|
||||
`(let ((,var (ext:mkstemp "ecl-tests")))
|
||||
(with-open-file (,stream ,var :direction :output)
|
||||
(format ,stream ,string))
|
||||
(multiple-value-prog1 (progn ,@body)
|
||||
(delete-file ,var))))))
|
||||
`(let ((,var (ext:mkstemp "ecl-tests")))
|
||||
(with-open-file (,stream ,var :direction :output)
|
||||
(format ,stream ,string ,@args))
|
||||
(multiple-value-prog1 (progn ,@body)
|
||||
(delete-file ,var)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue