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
//! PERSIST rows with their Common Lisp values: a variable does not hide a
6
//! macro in operator position.
7

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

            
11
use persist::{Row, assert_pinned, row};
12

            
13
const DBL: &str = "(defmacro dbl (x) `(* ,x 2))";
14

            
15
1
fn rows() -> Vec<Row> {
16
1
    vec![
17
1
        row("V1", &[DBL, "(defun g (dbl) (dbl dbl))", "(g 3)"]),
18
1
        row("V2", &[DBL, "(let ((dbl 4)) (dbl dbl))"]),
19
1
        row(
20
1
            "V3",
21
1
            &[DBL, "(labels ((dbl (x) (+ x 1))) (let ((dbl 4)) (dbl 10)))"],
22
1
        ),
23
1
        row(
24
1
            "V4",
25
1
            &[
26
1
                DBL,
27
1
                "(labels ((dbl (x) (+ x 1))) (let ((dbl 4)) (dbl dbl)))",
28
1
            ],
29
1
        ),
30
1
        row(
31
1
            "V5",
32
1
            &[
33
1
                DBL,
34
1
                "(labels ((dbl (x) (+ x 1))) (let ((dbl 4)) (dbl 10)))",
35
1
                "(let ((dbl 4)) (dbl dbl))",
36
1
            ],
37
1
        ),
38
    ]
39
1
}
40

            
41
/// CL: V1 6, V2 8, V3 11, V4 5, V5 8 once the LABELS form has ended.
42
const TODAY: &[(&str, &[&str])] = &[
43
    ("V1", &["dbl", "g", "6"]),
44
    ("V2", &["dbl", "8"]),
45
    ("V3", &["dbl", "11"]),
46
    ("V4", &["dbl", "5"]),
47
    ("V5", &["dbl", "11", "8"]),
48
];
49

            
50
#[test]
51
1
fn every_row_reads_as_common_lisp() {
52
1
    assert_pinned(&rows(), TODAY);
53
1
}