erg/tests/repl.rs
Shunsuke Shibayama 1d24655588 Add REPL tests
2023-01-17 16:32:25 +09:00

19 lines
429 B
Rust

mod common;
use common::expect_repl_success;
#[test]
fn exec_repl_helloworld() -> Result<(), ()> {
expect_repl_success(vec!["print! \"hello, world\"".into(), "exit()".into()])
}
#[test]
fn exec_repl_def_func() -> Result<(), ()> {
expect_repl_success(vec![
"f i =".into(),
" i + 1".into(),
"".into(),
"x = f 2".into(),
"assert x == 3".into(),
"exit()".into(),
])
}