Use `convert-syntax-error` from the `syntax/macro-testing` module:
http://docs.racket-lang.org/syntax/macro-testing.html#(form._((lib._syntax%2Fmacro-testing..rkt)._convert-syntax-error))
Ryan
On 06/30/2017 04:47 PM, Sam Waxman wrote:
Hello,
I'm trying to test whether or not certain programs result in syntax errors. For
example the program
#lang racket
a
will result in an unbound identifier error, even before runtime (you'll see the
little error message at the bottom because it errored in phase 1).
I know how to catch runtime errors, but I haven't been able to catch these
expansion time errors as of yet. I've tried doing roughly the same thing as
catching runtime errors, but with begin-for-syntax, but it hasn't been working
out for me.
Ideally, I want a macro like
(return-syntax-error stuff-to-expand ...)
that will run stuff-to-expand, and if runs into a syntax error, for it to be caught and
returned (as the error struct #<exn:fail:syntax *message* #<continuation mark>).
Any tips?
Many thanks in advance.
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.