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: a custom SHOULD-APPLY reads a carried global the unit writes
//! as the earlier unit left it, and the unit's store still lands.
#[path = "persist/rows.rs"]
mod persist;
use persist::{Row, assert_pinned, row};
const RESET: &str = "(defun should-apply () 1)";
fn rows() -> Vec<Row> {
vec![
row(
"T1a",
&[
"(defvar *m* 5)",
"(defun should-apply () (if (= *m* 5) 1 0)) (setf *m* 6)",
RESET,
"*m*",
],
),
"T1b",
"(defvar *l* (list 1 2))",
"(defun should-apply () (if (equal *l* (list 1 2)) 1 0)) (setf *l* (list 3))",
"*l*",
"T1c",
"(defvar *s* \"abc\")",
"(defun should-apply () (if (string= *s* \"abc\") 1 0)) (setf *s* \"xyz\")",
"*s*",
"T1d",
"(defstruct pt x)",
"(defvar *p* (make-pt :x 1))",
"(defun should-apply () (if (= (pt-x *p*) 1) 1 0)) (setf *p* (make-pt :x 9))",
"(pt-x *p*)",
"T1f",
"(defvar *f* (lambda (x) (+ x 1)))",
"(defun should-apply () (if (= (funcall *f* 1) 2) 1 0)) (setf *f* (lambda (x) (+ x 2)))",
"(funcall *f* 1)",
]
}
const CL: &[(&str, &[&str])] = &[
("T1a", &["-", "-", "-", "6"]),
("T1b", &["-", "-", "-", "(3)"]),
("T1c", &["-", "-", "-", "\"xyz\""]),
("T1d", &["pt", "-", "-", "-", "9"]),
("T1f", &["-", "-", "-", "3"]),
];
#[test]
fn every_row_reads_as_common_lisp() {
assert_pinned(&rows(), CL);