1
//! A function-form special (`ERROR`, `EVAL`, `APPLY`, …) named as a FUNCALL or
2
//! APPLY designator compiles in every position, never to an internal error.
3

            
4
use super::common::{compile_and_validate, compile_eval_and_validate};
5

            
6
#[test]
7
1
fn error_designator_compiles_in_catch_each() {
8
1
    compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'error 'boom \"m\"))");
9
1
    compile_eval_and_validate("(catch-each (list 1 2) x (funcall 'error 'boom \"m\"))");
10
1
}
11

            
12
#[test]
13
1
fn eval_and_apply_designators_compile_in_catch_each() {
14
1
    compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'eval '(+ 1 2)))");
15
1
    compile_eval_and_validate("(catch-each (list 1 2) x (funcall #'apply #'+ (list 1 2)))");
16
1
}
17

            
18
#[test]
19
1
fn error_designator_compiles_in_nested_positions() {
20
1
    compile_and_validate("(handler-case (funcall #'error 'boom \"m\") (t (e) 7))");
21
1
    compile_and_validate(
22
1
        "(defun f (x) (if (> x 0) x (funcall #'error 'neg \"neg\"))) \
23
1
         (handler-case (f -1) (neg (e) 0))",
24
1
    );
25
1
    compile_and_validate("(unwind-protect (funcall #'error 'boom \"m\") 1)");
26
1
}