Re: [racket-users] Catching syntax errors

2017-07-01 Thread Ryan Culpepper
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

Re: [racket-users] Catching syntax errors

2017-06-30 Thread Philip McGrath
If testing with parenthetical syntax is sufficient, you might want something like this: #lang racket (with-handlers ([exn:fail:syntax? values]) (eval `(module bad racket (define foo (define bar 1))) (make-base-namespace))) which returns: (exn:fail:syntax "define: not allowed in an

[racket-users] Catching syntax errors

2017-06-30 Thread Sam Waxman
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