Lines
100 %
Functions
Branches
// Skipped under Miri: these tests compile+run wasm via wasmtime, whose
// Cranelift backend refuses to run under Miri.
#![cfg(not(miri))]
//! PERSIST rows with their Common Lisp values: a name that is also a macro is
//! a variable where a binder names one, and is not expanded there.
#[path = "persist/rows.rs"]
mod persist;
use persist::{Row, assert_pinned, row};
const DBL: &str = "(defmacro dbl (x) `(* ,x 2))";
fn rows() -> Vec<Row> {
vec![
row("M1", &[DBL, "(funcall (lambda (y) (let ((dbl y)) 5)) 1)"]),
row(
"M2",
&[
DBL,
"(let ((f (lambda (y) (let ((dbl y)) (+ dbl 5))))) (funcall f 1))",
],
),
"M3",
&[DBL, "(defun g (y) (let ((dbl y)) (+ dbl 5)))", "(g 1)"],
"M4",
"(defvar *k* (lambda (y) (let ((dbl y)) 5)))",
"(funcall *k* 1)",
"M5",
"(defvar *k* (lambda (y) (let ((a (dbl y))) a)))",
"M6",
"(defvar *k* (lambda (y) (case y (dbl 1) (t 2))))",
"(funcall *k* 3)",
]
}
/// CL: M1 5, M2 6, M3 6, M4 5, M5 2, M6 2.
const TODAY: &[(&str, &[&str])] = &[
("M1", &["dbl", "5"]),
("M2", &["dbl", "6"]),
("M3", &["dbl", "g", "6"]),
("M4", &["dbl", "-", "5"]),
("M5", &["dbl", "-", "2"]),
("M6", &["dbl", "-", "2"]),
];
#[test]
fn every_row_reads_as_common_lisp() {
assert_pinned(&rows(), TODAY);