about summary refs log tree commit diff
path: root/src/compiletest
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-03 19:59:04 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-05 22:08:09 -0700
commit025d86624de982cdab7e6b13600fec1499c02b56 (patch)
tree96ba196f8a420c52e6034acd14f323d3d2239e29 /src/compiletest
parentc9d27693796fe4ced8568e11aa465750f743097b (diff)
Switch alts to use arrows
Diffstat (limited to 'src/compiletest')
-rw-r--r--src/compiletest/compiletest.rs37
-rw-r--r--src/compiletest/errors.rs4
-rw-r--r--src/compiletest/header.rs18
-rw-r--r--src/compiletest/procsrv.rs4
-rw-r--r--src/compiletest/runtest.rs22
-rw-r--r--src/compiletest/util.rs4
6 files changed, 46 insertions, 43 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 4fc88009bc6..39c4f0f81d0 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -43,8 +43,8 @@ fn parse_config(args: ~[~str]) -> config {
     let args_ = vec::tail(args);
     let matches =
         alt getopts::getopts(args_, opts) {
-          ok(m) { m }
-          err(f) { fail getopts::fail_str(f) }
+          ok(m) => m,
+          err(f) => fail getopts::fail_str(f)
         };
 
     return {compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
@@ -85,7 +85,7 @@ fn log_config(config: config) {
 }
 
 fn opt_str(maybestr: option<~str>) -> ~str {
-    alt maybestr { option::some(s) { s } option::none { ~"(none)" } }
+    alt maybestr { option::some(s) => s, option::none => ~"(none)" }
 }
 
 fn str_opt(maybestr: ~str) -> option<~str> {
@@ -94,20 +94,20 @@ fn str_opt(maybestr: ~str) -> option<~str> {
 
 fn str_mode(s: ~str) -> mode {
     alt s {
-      ~"compile-fail" { mode_compile_fail }
-      ~"run-fail" { mode_run_fail }
-      ~"run-pass" { mode_run_pass }
-      ~"pretty" { mode_pretty }
-      _ { fail ~"invalid mode" }
+      ~"compile-fail" => mode_compile_fail,
+      ~"run-fail" => mode_run_fail,
+      ~"run-pass" => mode_run_pass,
+      ~"pretty" => mode_pretty,
+      _ => fail ~"invalid mode"
     }
 }
 
 fn mode_str(mode: mode) -> ~str {
     alt mode {
-      mode_compile_fail { ~"compile-fail" }
-      mode_run_fail { ~"run-fail" }
-      mode_run_pass { ~"run-pass" }
-      mode_pretty { ~"pretty" }
+      mode_compile_fail => ~"compile-fail",
+      mode_run_fail => ~"run-fail",
+      mode_run_pass => ~"run-pass",
+      mode_pretty => ~"pretty"
     }
 }
 
@@ -121,14 +121,14 @@ fn run_tests(config: config) {
 fn test_opts(config: config) -> test::test_opts {
     {filter:
          alt config.filter {
-           option::some(s) { option::some(s) }
-           option::none { option::none }
+           option::some(s) => option::some(s),
+           option::none => option::none
          },
      run_ignored: config.run_ignored,
      logfile:
          alt config.logfile {
-           option::some(s) { option::some(s) }
-           option::none { option::none }
+           option::some(s) => option::some(s),
+           option::none => option::none
          }
     }
 }
@@ -149,7 +149,10 @@ fn make_tests(config: config) -> ~[test::test_desc] {
 fn is_test(config: config, testfile: ~str) -> bool {
     // Pretty-printer does not work with .rc files yet
     let valid_extensions =
-        alt config.mode { mode_pretty { ~[~".rs"] } _ { ~[~".rc", ~".rs"] } };
+        alt config.mode {
+          mode_pretty => ~[~".rs"],
+          _ => ~[~".rc", ~".rs"]
+        };
     let invalid_prefixes = ~[~".", ~"#", ~"~"];
     let name = path::basename(testfile);
 
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 431843d9268..8a550e94c78 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -24,8 +24,8 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
     let error_tag = ~"//~";
     let mut idx;
     alt str::find_str(line, error_tag) {
-         option::none { return ~[]; }
-         option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
+      option::none => return ~[],
+      option::some(nn) => { idx = (nn as uint) + str::len(error_tag); }
     }
 
     // "//~^^^ kind msg" denotes a message expected
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index ec214f5b586..731e874ddcc 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -31,8 +31,8 @@ fn load_props(testfile: ~str) -> test_props {
     let mut pp_exact = option::none;
     for iter_header(testfile) |ln| {
         alt parse_error_pattern(ln) {
-          option::some(ep) { vec::push(error_patterns, ep) }
-          option::none { }
+          option::some(ep) => vec::push(error_patterns, ep),
+          option::none => ()
         };
 
         if option::is_none(compile_flags) {
@@ -108,17 +108,17 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> {
         // nv is either FOO or FOO=BAR
         let strs = str::splitn_char(nv, '=', 1u);
         alt strs.len() {
-          1u { (strs[0], ~"") }
-          2u { (strs[0], strs[1]) }
-          n { fail fmt!{"Expected 1 or 2 strings, not %u", n}; }
+          1u => (strs[0], ~""),
+          2u => (strs[0], strs[1]),
+          n => fail fmt!{"Expected 1 or 2 strings, not %u", n}
         }
     }
 }
 
 fn parse_pp_exact(line: ~str, testfile: ~str) -> option<~str> {
     alt parse_name_value_directive(line, ~"pp-exact") {
-      option::some(s) { option::some(s) }
-      option::none {
+      option::some(s) => option::some(s),
+      option::none => {
         if parse_name_directive(line, ~"pp-exact") {
             option::some(path::basename(testfile))
         } else {
@@ -136,12 +136,12 @@ fn parse_name_value_directive(line: ~str,
                               directive: ~str) -> option<~str> unsafe {
     let keycolon = directive + ~":";
     alt str::find_str(line, keycolon) {
-        option::some(colon) {
+        option::some(colon) => {
             let value = str::slice(line, colon + str::len(keycolon),
                                    str::len(line));
             debug!{"%s: %s", directive,  value};
             option::some(value)
         }
-        option::none { option::none }
+        option::none => option::none
     }
 }
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index 1a642915cd5..bb9080becff 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -75,10 +75,10 @@ fn run(lib_path: ~str,
     while count > 0 {
         let stream = comm::recv(p);
         alt check stream {
-            (1, s) {
+            (1, s) => {
                 outs = s;
             }
-            (2, s) {
+            (2, s) => {
                 errs = s;
             }
         };
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index ac5c3161c47..79b7e6f08d4 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -19,10 +19,10 @@ fn run(config: config, testfile: ~str) {
     debug!{"running %s", testfile};
     let props = load_props(testfile);
     alt config.mode {
-      mode_compile_fail { run_cfail_test(config, props, testfile); }
-      mode_run_fail { run_rfail_test(config, props, testfile); }
-      mode_run_pass { run_rpass_test(config, props, testfile); }
-      mode_pretty { run_pretty_test(config, props, testfile); }
+      mode_compile_fail => run_cfail_test(config, props, testfile),
+      mode_run_fail => run_rfail_test(config, props, testfile),
+      mode_run_pass => run_rpass_test(config, props, testfile),
+      mode_pretty => run_pretty_test(config, props, testfile)
     }
 }
 
@@ -90,7 +90,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
     } else { logv(config, ~"testing for converging pretty-printing"); }
 
     let rounds =
-        alt props.pp_exact { option::some(_) { 1 } option::none { 2 } };
+        alt props.pp_exact { option::some(_) => 1, option::none => 2 };
 
     let mut srcs = ~[result::get(io::read_whole_file_str(testfile))];
 
@@ -110,11 +110,11 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
 
     let mut expected =
         alt props.pp_exact {
-          option::some(file) {
+          option::some(file) => {
             let filepath = path::connect(path::dirname(testfile), file);
             result::get(io::read_whole_file_str(filepath))
           }
-          option::none { srcs[vec::len(srcs) - 2u] }
+          option::none => { srcs[vec::len(srcs) - 2u] }
         };
     let mut actual = srcs[vec::len(srcs) - 1u];
 
@@ -384,8 +384,8 @@ fn make_run_args(config: config, _props: test_props, testfile: ~str) ->
             // then split apart its command
             let runtool =
                 alt config.runtool {
-                  option::some(s) { option::some(s) }
-                  option::none { option::none }
+                  option::some(s) => option::some(s),
+                  option::none => option::none
                 };
             split_maybe_args(runtool)
         };
@@ -403,8 +403,8 @@ fn split_maybe_args(argstr: option<~str>) -> ~[~str] {
     }
 
     alt argstr {
-      option::some(s) { rm_whitespace(str::split_char(s, ' ')) }
-      option::none { ~[] }
+      option::some(s) => rm_whitespace(str::split_char(s, ' ')),
+      option::none => ~[]
     }
 }
 
diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs
index fec0fc84bc3..027d247ebb8 100644
--- a/src/compiletest/util.rs
+++ b/src/compiletest/util.rs
@@ -8,10 +8,10 @@ fn make_new_path(path: ~str) -> ~str {
     // Windows just uses PATH as the library search path, so we have to
     // maintain the current value while adding our own
     alt getenv(lib_path_env_var()) {
-      option::some(curr) {
+      option::some(curr) => {
         fmt!{"%s%s%s", path, path_div(), curr}
       }
-      option::none { path }
+      option::none => path
     }
 }