Ryan,

Thanks for the pointers.

On 01/02/13 15:44, Ryan Culpepper wrote:
On 02/01/2013 09:39 AM, Tim Brown wrote:
I have an outstanding question about "unit-testing" syntactic extensions
from a couple of weeks ago. What do the heavier users of syntaxes use to
unit test their macros?

Either construct a namespace and use 'eval' or wrap the invalid syntax in
something that catches compile-time exceptions and produces code that
raises the same exception at run time.

The error tests for syntax-parse, for example, use the second technique.
See tests/stxparse/test-error; the macro that turns compile-time exceptions
into run-time exceptions is 'convert-syntax-errors' in
tests/stxparse/setup. IIRC, Eli's test macro does this by default, and
that's probably where I got the idea from.

I'll play around with these when I have a bit more time.

Tim

--
Tim Brown <[email protected]>  | City Computing Limited            |
T: +44 20 8770 2110                | City House, Sutton Park Road      |
F: +44 20 8770 2130                | Sutton, Surrey, SM1 2AE, GB       |
-----------------------------------------------------------------------|
BEAUTY:  What's in your eye when you have a bee in your hand           |
-----------------------------------------------------------------------'
City Computing Limited registered in London No. 1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT number 372 8290 34.
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to