about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-05-13 18:45:47 -0400
committerAlex Crichton <alex@alexcrichton.com>2013-05-14 14:11:08 -0400
commit9af04f3e77b201d9a33ebfaeaf622aa44e782d71 (patch)
treea5b6091914e70ee5cc5b885009ca20b15407bfa6
parent4a9d8ff1a7ee6e832cceb582cb213ac6444f09b6 (diff)
downloadrust-9af04f3e77b201d9a33ebfaeaf622aa44e782d71.tar.gz
rust-9af04f3e77b201d9a33ebfaeaf622aa44e782d71.zip
Add regression tests for various other rusti issues
-rw-r--r--src/librusti/rusti.rc33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc
index 1b60966005c..21cc8d60e49 100644
--- a/src/librusti/rusti.rc
+++ b/src/librusti/rusti.rc
@@ -437,21 +437,13 @@ mod tests {
         }
     }
 
-    fn super_simple() {
+    fn run_cmds(cmds: &[&str]) {
         let mut r = repl();
-        let result = run_line(&mut r, io::stdin(), io::stdout(), ~"", false);
-        result.expect("empty input shouldn't fail in rusti");
-    }
-
-    fn use_does_not_crash() {
-        // Regression tests for #5937
-        let mut r = repl();
-        let result = run_line(&mut r, io::stdin(), io::stdout(),
-                              ~"use core::util::with;", false);
-        r = result.expect("use statements should't fail in rusti");
-        let result = run_line(&mut r, io::stdin(), io::stdout(),
-                              ~"", false);
-        result.expect("something should be able to happen after a use statement");
+        for cmds.each |&cmd| {
+            let result = run_line(&mut r, io::stdin(), io::stdout(),
+                                  cmd.to_owned(), false);
+            r = result.expect(fmt!("the command '%s' failed", cmd));
+        }
     }
 
     #[test]
@@ -464,8 +456,17 @@ mod tests {
         //
         // To get some interesting output, run with RUST_LOG=rusti::tests
 
-        debug!("super_simple");       super_simple();
-        debug!("use_does_not_crash"); use_does_not_crash();
+        debug!("hopefully this runs");
+        run_cmds([""]);
+
+        debug!("regression test for #5937");
+        run_cmds(["use core;", ""]);
+
+        debug!("regression test for #5784");
+        run_cmds(["let a = 1;"]);
 
+        debug!("regression test for #5803");
+        run_cmds(["spawn( || println(\"Please don't segfault\") );",
+                  "do spawn { println(\"Please?\"); }"]);
     }
 }