From 96d6a0a2b562f81c5c14532487ce03a1a9065e6b Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Sun, 29 Sep 2024 17:26:45 +0200 Subject: Implement sub-process based tester --- rust/tests/interpret_test.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'rust/tests') diff --git a/rust/tests/interpret_test.rs b/rust/tests/interpret_test.rs index 0ca3356..16e7fb7 100644 --- a/rust/tests/interpret_test.rs +++ b/rust/tests/interpret_test.rs @@ -1,4 +1,4 @@ -use lambda::io::{eval_file, repl}; +use lambda::io::{batch_eval, eval_file, repl}; #[test] fn interpreter_can_read_and_interpret_file() { @@ -15,3 +15,11 @@ fn repl_can_read_and_interpret_input() { repl(&mut input.as_bytes(), &mut output); assert_eq!("> true\n> 12\n> ", String::from_utf8(output).unwrap()); } + +#[test] +fn repl_can_read_and_interpret_input_in_batch_mode() { + let input = "(def id (lam x x))\n(id 12)"; + let mut output = Vec::new(); + batch_eval(&mut input.as_bytes(), &mut output); + assert_eq!("true\n12\n", String::from_utf8(output).unwrap()); +} -- cgit v1.2.3