1
// Skipped under Miri: these tests compile+run wasm via wasmtime, whose
2
// Cranelift backend refuses to run under Miri.
3
#![cfg(not(miri))]
4

            
5
//! A bare name of a Common Lisp function used as a value is an unbound
6
//! variable, never "special form" or "macro" (plan L2-3c). SBCL: unbound
7
//! variable in every row; IF and WHEN keep their own texts.
8

            
9
#[path = "persist/rows.rs"]
10
mod persist;
11

            
12
use persist::{Row, assert_pinned, assert_pinned_wide, row};
13

            
14
1
fn rows() -> Vec<Row> {
15
1
    vec![
16
1
        row("C1", &["(list macroexpand)"]),
17
1
        row("C2", &["(let ((x funcall)) x)"]),
18
1
        row("C3", &["(print mapcar)"]),
19
1
        row("C4", &["(list 1+)"]),
20
1
        row("C5", &["(list apply)"]),
21
    ]
22
1
}
23

            
24
1
fn operator_rows() -> Vec<Row> {
25
1
    vec![row("C6", &["(list if)"]), row("C7", &["(list when)"])]
26
1
}
27

            
28
const VALUES: &[(&str, &[&str])] = &[
29
    (
30
        "C1",
31
        &["err: Compile error: variable MACROEXPAND is unbound; use 'macroexpand or #'macroexpand"],
32
    ),
33
    (
34
        "C2",
35
        &["err: Compile error: variable FUNCALL is unbound; use 'funcall or #'funcall"],
36
    ),
37
    (
38
        "C3",
39
        &["err: Compile error: MAPCAR cannot be used as a function value yet"],
40
    ),
41
    (
42
        "C4",
43
        &["err: Compile error: 1+ cannot be used as a function value yet"],
44
    ),
45
    (
46
        "C5",
47
        &["err: Compile error: variable APPLY is unbound; use 'apply or #'apply"],
48
    ),
49
];
50

            
51
#[test]
52
1
fn a_cl_function_name_as_a_value_is_unbound() {
53
1
    assert_pinned_wide(&rows(), VALUES, 100);
54
1
}
55

            
56
const OPERATORS: &[(&str, &[&str])] = &[
57
    ("C6", &["err: Compile error: 'IF' is a special form and ca"]),
58
    ("C7", &["err: Compile error: 'WHEN' is a macro and cannot "]),
59
];
60

            
61
#[test]
62
1
fn a_real_operator_as_a_value_keeps_its_text() {
63
1
    assert_pinned(&operator_rows(), OPERATORS);
64
1
}