Skip to content

Commit eb38fda

Browse files
committed
test(pluginlab): add test for $?
1 parent 8595286 commit eb38fda

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

crates/pluginlab/tests/e2e_test.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ mod e2e_test {
166166
}
167167

168168
#[test]
169-
fn test_empty_line() {
169+
fn test_empty_line_and_dollar_question_mark() {
170170
let project_root = find_project_root();
171171
println!("Setting current directory to: {:?}", project_root);
172172
std::env::set_current_dir(&project_root).unwrap();
173173
let mut session = spawn(
174-
&build_command(&["plugin_greet.wasm"], "repl_logic_guest.wasm"),
174+
&build_command(&["plugin_echo.wasm"], "repl_logic_guest.wasm"),
175175
Some(TEST_TIMEOUT),
176176
)
177177
.expect("Can't launch pluginlab with plugin greet");
@@ -205,6 +205,18 @@ mod e2e_test {
205205
session
206206
.exp_string("repl(1)>")
207207
.expect("Empty command should lead to a new prompt, without changing $?");
208+
session
209+
.send_line("echo $?")
210+
.expect("Failed to send command");
211+
session
212+
.exp_string("1")
213+
.expect("Didn't get expected echo output for $? after previous command failed");
214+
session
215+
.send_line("echo $?")
216+
.expect("Failed to send command");
217+
session
218+
.exp_string("0")
219+
.expect("Didn't get expected echo output for $? after previous command succeeded");
208220
}
209221

210222
#[test]

0 commit comments

Comments
 (0)