summaryrefslogtreecommitdiff
path: root/rust/tests
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud.bailly@iohk.io>2024-09-25 14:37:06 +0200
committerArnaud Bailly <arnaud.bailly@iohk.io>2024-09-25 14:37:06 +0200
commit0fed41e6afbf32d274660cc3ec435686901d12c4 (patch)
treea126f10db0e439ff8c55df8b78652e47d3f63486 /rust/tests
parent778881eda5b0955fb4c845fb29097f048491f007 (diff)
downloadlambda-nantes-0fed41e6afbf32d274660cc3ec435686901d12c4.tar.gz
Introduce basic REPL
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/interpret_test.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/tests/interpret_test.rs b/rust/tests/interpret_test.rs
index 61b0712..40c3ee5 100644
--- a/rust/tests/interpret_test.rs
+++ b/rust/tests/interpret_test.rs
@@ -7,3 +7,11 @@ fn interpreter_can_read_and_interpret_file() {
assert_eq!("1", eval_file("sample/test_normal.txt"));
assert_eq!("13", eval_file("sample/test_let.txt"));
}
+
+#[test]
+fn repl_can_read_and_interpret_input() {
+ let input = "(def id (lam x x))\n(id 12)";
+ let mut output = Vec::new();
+ lambda::repl(&mut input.as_bytes(), &mut output);
+ assert_eq!("> true\n> 12\n> ", String::from_utf8(output).unwrap());
+}