diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-06 12:34:08 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-06 15:36:30 -0700 |
| commit | ecaf9e39c9435fa2de4fe393c4b263be36eb2d99 (patch) | |
| tree | 775f69be65adff65551d96173dd797e32e2c3157 /src/compiletest | |
| parent | d3a9bb1bd4a1d510bbaca2ab1121e4c85a239247 (diff) | |
Convert alt to match. Stop parsing alt
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/compiletest.rs | 14 | ||||
| -rw-r--r-- | src/compiletest/errors.rs | 2 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 8 | ||||
| -rw-r--r-- | src/compiletest/procsrv.rs | 2 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 10 | ||||
| -rw-r--r-- | src/compiletest/util.rs | 2 |
6 files changed, 19 insertions, 19 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 33b9655aeb2..fd9a12aa1f7 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -37,7 +37,7 @@ fn parse_config(args: ~[~str]) -> config { assert (vec::is_not_empty(args)); let args_ = vec::tail(args); let matches = - alt getopts::getopts(args_, opts) { + match getopts::getopts(args_, opts) { ok(m) => m, err(f) => fail getopts::fail_str(f) }; @@ -80,7 +80,7 @@ fn log_config(config: config) { } fn opt_str(maybestr: option<~str>) -> ~str { - alt maybestr { option::some(s) => s, option::none => ~"(none)" } + match maybestr { option::some(s) => s, option::none => ~"(none)" } } fn str_opt(maybestr: ~str) -> option<~str> { @@ -88,7 +88,7 @@ fn str_opt(maybestr: ~str) -> option<~str> { } fn str_mode(s: ~str) -> mode { - alt s { + match s { ~"compile-fail" => mode_compile_fail, ~"run-fail" => mode_run_fail, ~"run-pass" => mode_run_pass, @@ -98,7 +98,7 @@ fn str_mode(s: ~str) -> mode { } fn mode_str(mode: mode) -> ~str { - alt mode { + match mode { mode_compile_fail => ~"compile-fail", mode_run_fail => ~"run-fail", mode_run_pass => ~"run-pass", @@ -115,13 +115,13 @@ fn run_tests(config: config) { fn test_opts(config: config) -> test::test_opts { {filter: - alt config.filter { + match config.filter { option::some(s) => option::some(s), option::none => option::none }, run_ignored: config.run_ignored, logfile: - alt config.logfile { + match config.logfile { option::some(s) => option::some(s), option::none => option::none } @@ -144,7 +144,7 @@ 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 { + match config.mode { mode_pretty => ~[~".rs"], _ => ~[~".rc", ~".rs"] }; diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 8a550e94c78..53599a9ad0e 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -23,7 +23,7 @@ fn load_errors(testfile: ~str) -> ~[expected_error] { fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe { let error_tag = ~"//~"; let mut idx; - alt str::find_str(line, error_tag) { + match str::find_str(line, error_tag) { option::none => return ~[], option::some(nn) => { idx = (nn as uint) + str::len(error_tag); } } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 731e874ddcc..bf58e809692 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -30,7 +30,7 @@ fn load_props(testfile: ~str) -> test_props { let mut compile_flags = option::none; let mut pp_exact = option::none; for iter_header(testfile) |ln| { - alt parse_error_pattern(ln) { + match parse_error_pattern(ln) { option::some(ep) => vec::push(error_patterns, ep), option::none => () }; @@ -107,7 +107,7 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> { do parse_name_value_directive(line, ~"exec-env").map |nv| { // nv is either FOO or FOO=BAR let strs = str::splitn_char(nv, '=', 1u); - alt strs.len() { + match strs.len() { 1u => (strs[0], ~""), 2u => (strs[0], strs[1]), n => fail fmt!{"Expected 1 or 2 strings, not %u", n} @@ -116,7 +116,7 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> { } fn parse_pp_exact(line: ~str, testfile: ~str) -> option<~str> { - alt parse_name_value_directive(line, ~"pp-exact") { + match parse_name_value_directive(line, ~"pp-exact") { option::some(s) => option::some(s), option::none => { if parse_name_directive(line, ~"pp-exact") { @@ -135,7 +135,7 @@ fn parse_name_directive(line: ~str, directive: ~str) -> bool { fn parse_name_value_directive(line: ~str, directive: ~str) -> option<~str> unsafe { let keycolon = directive + ~":"; - alt str::find_str(line, keycolon) { + match str::find_str(line, keycolon) { option::some(colon) => { let value = str::slice(line, colon + str::len(keycolon), str::len(line)); diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index a8418a545a2..ba4249999a4 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -76,7 +76,7 @@ fn run(lib_path: ~str, let mut outs = ~""; let mut count = 2; while count > 0 { - alt p.recv() { + match p.recv() { (1, s) => { outs = s; } diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 79b7e6f08d4..7a2d3456ed6 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -18,7 +18,7 @@ fn run(config: config, testfile: ~str) { } debug!{"running %s", testfile}; let props = load_props(testfile); - alt config.mode { + match 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), @@ -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 }; + match props.pp_exact { option::some(_) => 1, option::none => 2 }; let mut srcs = ~[result::get(io::read_whole_file_str(testfile))]; @@ -109,7 +109,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) { } let mut expected = - alt props.pp_exact { + match props.pp_exact { option::some(file) => { let filepath = path::connect(path::dirname(testfile), file); result::get(io::read_whole_file_str(filepath)) @@ -383,7 +383,7 @@ fn make_run_args(config: config, _props: test_props, testfile: ~str) -> // If we've got another tool to run under (valgrind), // then split apart its command let runtool = - alt config.runtool { + match config.runtool { option::some(s) => option::some(s), option::none => option::none }; @@ -402,7 +402,7 @@ fn split_maybe_args(argstr: option<~str>) -> ~[~str] { vec::filter_map(v, flt) } - alt argstr { + match argstr { option::some(s) => rm_whitespace(str::split_char(s, ' ')), option::none => ~[] } diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index 027d247ebb8..0c7a0235bee 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -7,7 +7,7 @@ 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()) { + match getenv(lib_path_env_var()) { option::some(curr) => { fmt!{"%s%s%s", path, path_div(), curr} } |
