test: option variants get imported by default

This commit is contained in:
Erick Tryzelaar 2012-12-28 11:28:36 -05:00
parent fa5ee934ed
commit 5b2b13bff8
4 changed files with 26 additions and 26 deletions

View file

@ -33,8 +33,8 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
let error_tag = ~"//~";
let mut idx;
match str::find_str(line, error_tag) {
option::None => return ~[],
option::Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
None => return ~[],
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
}
// "//~^^^ kind msg" denotes a message expected

View file

@ -34,12 +34,12 @@ fn load_props(testfile: &Path) -> test_props {
let mut error_patterns = ~[];
let mut aux_builds = ~[];
let mut exec_env = ~[];
let mut compile_flags = option::None;
let mut pp_exact = option::None;
let mut compile_flags = None;
let mut pp_exact = None;
for iter_header(testfile) |ln| {
match parse_error_pattern(ln) {
option::Some(ep) => error_patterns.push(ep),
option::None => ()
Some(ep) => error_patterns.push(ep),
None => ()
};
if compile_flags.is_none() {
@ -124,12 +124,12 @@ fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
fn parse_pp_exact(line: ~str, testfile: &Path) -> Option<Path> {
match parse_name_value_directive(line, ~"pp-exact") {
option::Some(s) => option::Some(Path(s)),
option::None => {
Some(s) => Some(Path(s)),
None => {
if parse_name_directive(line, ~"pp-exact") {
option::Some(testfile.file_path())
Some(testfile.file_path())
} else {
option::None
None
}
}
}
@ -143,12 +143,12 @@ fn parse_name_value_directive(line: ~str,
directive: ~str) -> Option<~str> unsafe {
let keycolon = directive + ~":";
match str::find_str(line, keycolon) {
option::Some(colon) => {
Some(colon) => {
let value = str::slice(line, colon + str::len(keycolon),
str::len(line));
debug!("%s: %s", directive, value);
option::Some(value)
Some(value)
}
option::None => option::None
None => None
}
}

View file

@ -117,7 +117,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
} else { logv(config, ~"testing for converging pretty-printing"); }
let rounds =
match props.pp_exact { option::Some(_) => 1, option::None => 2 };
match props.pp_exact { Some(_) => 1, None => 2 };
let mut srcs = ~[io::read_whole_file_str(testfile).get()];
@ -137,11 +137,11 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
let mut expected =
match props.pp_exact {
option::Some(file) => {
Some(file) => {
let filepath = testfile.dir_path().push_rel(&file);
io::read_whole_file_str(&filepath).get()
}
option::None => { srcs[vec::len(srcs) - 2u] }
None => { srcs[vec::len(srcs) - 2u] }
};
let mut actual = srcs[vec::len(srcs) - 1u];
@ -165,7 +165,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
fn print_source(config: config, testfile: &Path, src: ~str) -> procres {
compose_and_run(config, testfile, make_pp_args(config, testfile),
~[], config.compile_lib_path, option::Some(src))
~[], config.compile_lib_path, Some(src))
}
fn make_pp_args(config: config, _testfile: &Path) -> procargs {
@ -199,7 +199,7 @@ actual:\n\
compose_and_run_compiler(
config, props, testfile,
make_typecheck_args(config, testfile),
option::Some(src))
Some(src))
}
fn make_typecheck_args(config: config, testfile: &Path) -> procargs {
@ -418,7 +418,7 @@ fn exec_compiled_test(config: config, props: test_props,
compose_and_run(config, testfile,
make_run_args(config, props, testfile),
props.exec_env,
config.run_lib_path, option::None)
config.run_lib_path, None)
}
fn compose_and_run_compiler(
@ -441,7 +441,7 @@ fn compose_and_run_compiler(
make_compile_args(config, props, ~[~"--lib"] + extra_link_args,
|a,b| make_lib_name(a, b, testfile), &abs_ab);
let auxres = compose_and_run(config, &abs_ab, aux_args, ~[],
config.compile_lib_path, option::None);
config.compile_lib_path, None);
if auxres.status != 0 {
fatal_procres(
fmt!("auxiliary build of %s failed to compile: ",
@ -501,8 +501,8 @@ fn make_run_args(config: config, _props: test_props, testfile: &Path) ->
// then split apart its command
let runtool =
match config.runtool {
option::Some(s) => option::Some(s),
option::None => option::None
Some(s) => Some(s),
None => None
};
split_maybe_args(runtool)
};
@ -517,8 +517,8 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
}
match argstr {
option::Some(s) => rm_whitespace(str::split_char(s, ' ')),
option::None => ~[]
Some(s) => rm_whitespace(str::split_char(s, ' ')),
None => ~[]
}
}

View file

@ -17,10 +17,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
match getenv(lib_path_env_var()) {
option::Some(curr) => {
Some(curr) => {
fmt!("%s%s%s", path, path_div(), curr)
}
option::None => path
None => path
}
}