summaryrefslogtreecommitdiffstats
path: root/tests/common.tl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common.tl')
-rw-r--r--tests/common.tl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/common.tl b/tests/common.tl
index 9f7e6eb3..f89d6ed8 100644
--- a/tests/common.tl
+++ b/tests/common.tl
@@ -26,6 +26,9 @@
(defmacro mtest (. pairs)
^(progn ,*(mapcar (op cons 'test) (tuples 2 pairs))))
+(defmacro mstest (. pairs)
+ ^(progn ,*(mapcar (op cons 'stest) (tuples 2 pairs))))
+
(defun os-symbol ()
(if (ignerr (dlsym (dlopen "libandroid.so") "AAsset_close"))
:android
@@ -50,3 +53,11 @@
(let ,bindings
(expand '(progn ,*body) ,env))))
(,invoke))))
+
+(defmacro with-temp-file ((name-var stream-var prefix) . body)
+ ^(let* ((,stream-var (mkstemp ,prefix))
+ (,name-var (stream-get-prop ,stream-var :name)))
+ (unwind-protect
+ (progn ,*body)
+ (close-stream ,stream-var)
+ (remove-path ,name-var))))