summaryrefslogtreecommitdiffstats
path: root/tests/common.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-19 07:23:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-19 07:23:47 -0700
commitb0469c2779c0879a25631675b3547a13f55e3e91 (patch)
treee5432da40b2175742b3a1b62feb0ed7adb550109 /tests/common.tl
parent35db3eee550d7d97e35c1dc58615b6530dd13360 (diff)
downloadtxr-b0469c2779c0879a25631675b3547a13f55e3e91.tar.gz
txr-b0469c2779c0879a25631675b3547a13f55e3e91.tar.bz2
txr-b0469c2779c0879a25631675b3547a13f55e3e91.zip
compile/eval: print compiler error on *stderr*.
* share/txr/stdlib/error.tl (compile-error): Print the error message on *stderr*, like we do with warnings. This allows the programming environment to pick up the error message and navigate to that line accordingly. The error message is also output by the unhandled exception logic but with a prefix that prevents parsing by the tooling. To avoid sending double error messages to the interactive user, we only issue the *stderr* message if *load-recursive* is true. * tests/common.tl (macro-time-let): New macro. This lets us bind special variables around the macro-expansion of the body, which is useful when expansion-time logic reacts to values of special variables. * tests/012/ifa.tl: Use macro-time-let to suppress *stderr* around the expansion of the erroneous ifa form. We now needs this because the error situation spits out a message on *stderr*, in addition to throwing.
Diffstat (limited to 'tests/common.tl')
-rw-r--r--tests/common.tl7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/common.tl b/tests/common.tl
index cdfc6c6a..accbf1f7 100644
--- a/tests/common.tl
+++ b/tests/common.tl
@@ -39,3 +39,10 @@
(caseql (os-symbol)
((:linux :solaris :macos :android) (dlopen nil))
((:cygwin) (dlopen "cygwin1.dll"))))
+
+(defmacro macro-time-let (:env env bindings . body)
+ (with-gensyms (invoke)
+ ^(macrolet ((,invoke ()
+ (let ,bindings
+ (expand '(progn ,*body) ,env))))
+ (,invoke))))