@@ -437,21 +437,13 @@ mod tests {
437
437
}
438
438
}
439
439
440
- fn super_simple( ) {
440
+ fn run_cmds(cmds: &[&str] ) {
441
441
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
+ }
455
447
}
456
448
457
449
#[test]
@@ -464,8 +456,17 @@ mod tests {
464
456
//
465
457
// To get some interesting output, run with RUST_LOG=rusti::tests
466
458
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;"]);
469
467
468
+ debug!("regression test for #5803");
469
+ run_cmds(["spawn( || println(\"Please don't segfault\") );",
470
+ "do spawn { println(\"Please?\"); }"]);
470
471
}
471
472
}
0 commit comments