mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Drop pending_src, fix repl tips
This commit is contained in:
parent
6038965cb6
commit
5b36d2c41c
3 changed files with 34 additions and 67 deletions
|
@ -1,4 +1,4 @@
|
|||
use roc_repl_cli::repl_state::{validate, ReplState};
|
||||
use roc_repl_cli::repl_state::{validate, ReplState, TIPS};
|
||||
use rustyline::validate::ValidationResult;
|
||||
|
||||
#[test]
|
||||
|
@ -8,13 +8,20 @@ fn one_plus_one() {
|
|||
|
||||
assert_valid(input);
|
||||
assert_step(input, &mut state, Ok("2 : Num * # TODOval1"));
|
||||
assert_done(&state);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tips() {
|
||||
let mut state = ReplState::new();
|
||||
let input = "";
|
||||
|
||||
assert_valid(input);
|
||||
assert_eq!(state.step(input), Ok(format!("\n{TIPS}\n")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn standalone_annotation() {
|
||||
let mut state = ReplState::new();
|
||||
|
||||
let mut input = "x : Str".to_string();
|
||||
|
||||
assert_incomplete(&input); // Since this was incomplete, rustyline won't step the state.
|
||||
|
@ -22,8 +29,7 @@ fn standalone_annotation() {
|
|||
input.push('\n');
|
||||
|
||||
assert_valid(&input);
|
||||
assert_step("", &mut state, Ok(""));
|
||||
assert_done(&state);
|
||||
assert_step(&input, &mut state, Ok(""));
|
||||
}
|
||||
|
||||
fn assert_valid(input: &str) {
|
||||
|
@ -50,12 +56,3 @@ fn assert_step(input: &str, state: &mut ReplState, expected_step_result: Result<
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_done(state: &ReplState) {
|
||||
assert_eq!(
|
||||
state.pending_src,
|
||||
String::new(),
|
||||
"pending_src was not empty; it was {:?}",
|
||||
state.pending_src
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue