summaryrefslogtreecommitdiff
path: root/rust/tests
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud.bailly@iohk.io>2024-09-29 17:26:45 +0200
committerArnaud Bailly <arnaud.bailly@iohk.io>2024-09-29 17:26:45 +0200
commit96d6a0a2b562f81c5c14532487ce03a1a9065e6b (patch)
tree0137b403fe0e8fdfbbe979f4081ae25cabdc96f2 /rust/tests
parent9dcff1ea1b11f765f074d9b93e67bc6760f52049 (diff)
downloadlambda-nantes-96d6a0a2b562f81c5c14532487ce03a1a9065e6b.tar.gz
Implement sub-process based tester
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/interpret_test.rs10
1 files changed, 9 insertions, 1 deletions
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());
+}