Skip to content

Commit 9af04f3

Browse files
committed
Add regression tests for various other rusti issues
1 parent 4a9d8ff commit 9af04f3

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

Diff for: src/librusti/rusti.rc

+17-16
Original file line numberDiff line numberDiff line change
@@ -437,21 +437,13 @@ mod tests {
437437
}
438438
}
439439

440-
fn super_simple() {
440+
fn run_cmds(cmds: &[&str]) {
441441
let mut r = repl();
442-
let result = run_line(&mut r, io::stdin(), io::stdout(), ~"", false);
443-
result.expect("empty input shouldn't fail in rusti");
444-
}
445-
446-
fn use_does_not_crash() {
447-
// Regression tests for #5937
448-
let mut r = repl();
449-
let result = run_line(&mut r, io::stdin(), io::stdout(),
450-
~"use core::util::with;", false);
451-
r = result.expect("use statements should't fail in rusti");
452-
let result = run_line(&mut r, io::stdin(), io::stdout(),
453-
~"", false);
454-
result.expect("something should be able to happen after a use statement");
442+
for cmds.each |&cmd| {
443+
let result = run_line(&mut r, io::stdin(), io::stdout(),
444+
cmd.to_owned(), false);
445+
r = result.expect(fmt!("the command '%s' failed", cmd));
446+
}
455447
}
456448

457449
#[test]
@@ -464,8 +456,17 @@ mod tests {
464456
//
465457
// To get some interesting output, run with RUST_LOG=rusti::tests
466458

467-
debug!("super_simple"); super_simple();
468-
debug!("use_does_not_crash"); use_does_not_crash();
459+
debug!("hopefully this runs");
460+
run_cmds([""]);
461+
462+
debug!("regression test for #5937");
463+
run_cmds(["use core;", ""]);
464+
465+
debug!("regression test for #5784");
466+
run_cmds(["let a = 1;"]);
469467

468+
debug!("regression test for #5803");
469+
run_cmds(["spawn( || println(\"Please don't segfault\") );",
470+
"do spawn { println(\"Please?\"); }"]);
470471
}
471472
}

0 commit comments

Comments
 (0)