6.2.900.17
15 Macro Testing
(phase1-eval ct-expr maybe-quote maybe-catch?)
|
| |
| maybe-quote | | = | | | | | | | | | #:quote quote-id | | | | | | | | maybe-catch? | | = | | | | | | | | | #:catch? catch? |
|
Evaluates
ct-expr at compile time and quotes the result using
quote-id, which defaults to
quote. Another suitable
argument for
quote-id is
quote-syntax.
If catch? is #t, then if the evaluation of
ct-expr raises a compile-time exception, it is caught and
converted to a run-time exception.
Equivalent to
(#%expression expr) except if expansion of
expr causes a compile-time exception to be raised; in that
case, the compile-time exception is converted to a run-time exception
raised when the expression is evaluated.
Use convert-compile-time-error to write tests for
compile-time error checking like syntax errors:
Examples: |
| | | -------------------- | FAILURE | message: "Wrong exception raised" | exn-message: "eval:6:0: lambda: bad syntax\n in: (lambda)" | exn: #(struct:exn:fail:syntax "eval:6:0: lambda: bad syntax\n in: (lambda)" #<continuation-mark-set> (#<syntax:6:0 (lambda)>)) | name: check-exn | location: (eval 6 0 6 1) | expression: (check-exn #rx"missing formals and body" (lambda () (convert-compile-time-error (lambda)))) | params: (#rx"missing formals and body" #<procedure:temp10>) |
| Check failure | -------------------- |
| |
|
Without the use of convert-compile-time-error, the checks
above would not be executed because the test program would not compile.
Added in version 6.2.900.6 of package base.