-
-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RackUnit check-exn fails to catch raised syntax error when error not called directly #2996
Comments
I believe that's because the exception is being raise at compile time (phase 1) and that's not when |
I think you will find https://docs.racket-lang.org/syntax/macro-testing.html#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29 useful. Edit: what about this?
|
Yes that is very helpful thanks a bunch works perfectly! Not that that is a hassle at at all, but for curiosities sake, is there a reason why check-exn does't wrap the convert-compile-time-error procedure around the check-exn thunk procedure? It seems that would be useful especially for syntax errors unit testing which may often produce the error testing for not at runtime. |
The designers of rackunit decided not to do that, IMO, wisely in this case,
since catching exceptions is routinely a runtime issue. (Although the extra
think doesn't seem necessary to me.)
In other words, it is best to pick a phase to evaluate things and not try
to do things simultaneously in multiple phases as would be required here.
Robby
…On Thu, Jan 2, 2020 at 9:25 AM Tommy McHugh ***@***.***> wrote:
Yes that is very helpful thanks a bunch works perfectly! Not that that is
a hassle at at all, but for curiosities sake, is there a reason why
check-exn does't wrap the convert-compile-time-error procedure around the
check-exn thunk procedure? It seems that would be useful especially for
syntax errors unit testing which may often produce the error testing for
not at runtime.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2996?email_source=notifications&email_token=AADBNMAPU3SXO7AVJ25XGV3Q3YBPTA5CNFSM4KCDKYY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH6S2PY#issuecomment-570240319>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBNMA4ZKLQVRLAJMHRGILQ3YBPTANCNFSM4KCDKYYQ>
.
|
Gotcha, make sense. Thanks for the assistance on this! |
A separate |
@jackfirth I'll build it out and report back. Will reopen for now to see if there is interest in this. |
@tommymchugh Sounds great 🙂 Heads up: the implementation of rackunit is in the repository racket/rackunit, not racket/racket. |
racket/rackunit#114 is the PR with the implementation. Comments, contributions, etc. are welcome! |
Since everything works as expected, can we close this issue, @tommymchugh? |
Yup! |
Example:
First check passes, but second check never seems to catch that raise-syntax-error (and thus produces an exn:fail:syntax) is called when the identifier is called for a struct that has a different constructor name.
The text was updated successfully, but these errors were encountered: