Lines
100 %
Functions
Branches
//! A function-form special (`ERROR`, `EVAL`, `APPLY`, …) named as a FUNCALL or
//! APPLY designator compiles in every position, never to an internal error.
use super::common::{compile_and_validate, compile_eval_and_validate};
#[test]
fn error_designator_compiles_in_catch_each() {
compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'error 'boom \"m\"))");
compile_eval_and_validate("(catch-each (list 1 2) x (funcall 'error 'boom \"m\"))");
}
fn eval_and_apply_designators_compile_in_catch_each() {
compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'eval '(+ 1 2)))");
compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'apply #'+ (list 1 2)))");
fn error_designator_compiles_in_nested_positions() {
compile_and_validate("(handler-case (funcall #'error 'boom \"m\") (t (e) 7))");
compile_and_validate(
"(defun f (x) (if (> x 0) x (funcall #'error 'neg \"neg\"))) \
(handler-case (f -1) (neg (e) 0))",
);
compile_and_validate("(unwind-protect (funcall #'error 'boom \"m\") 1)");