blob: 0ca3356b96f001e2e8f47f7b2315719c330d06c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use lambda::io::{eval_file, repl};
#[test]
fn interpreter_can_read_and_interpret_file() {
assert_eq!("12 foo true (x x)", eval_file("sample/test.txt"));
assert_eq!("true", eval_file("sample/test_full.txt"));
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();
repl(&mut input.as_bytes(), &mut output);
assert_eq!("> true\n> 12\n> ", String::from_utf8(output).unwrap());
}
|