On Fri, Oct 25, 2013 at 12:53 AM, Michael Montague <[email protected]>wrote:
> My reader includes location information when it reads identifiers and
> quote strips all that out. I want that to be part of the tests and I
> want to be able to test for specific errors. I will put more thought
> into it and figure out a way to make my tests work in (chibi test).
>
It's not really possible without implementation-specific
extensions, because the error is happening at compile
time, and there's no standard way to catch compile-time
errors.
You could write a low-level macro that evaluates it's body:
(define-syntax test-syntax
(er-macro-transformer
(lambda (expr rename compare)
(guard (else (exn '(test-assert "syntax bad" #f)))
(eval expr)
'(test-assert "syntax ok" #t)))))
and maybe preserve the source info there, but it's still
just falling back on eval.
As an implementation-specific extension you could provide
a syntax-guard form which can catch macro errors, which
would be a cleaner solution.
--
Alex
_______________________________________________
Scheme-reports mailing list
[email protected]
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports