Skip to content

Commit 5b2b13b

Browse files
committed
test: option variants get imported by default
1 parent fa5ee93 commit 5b2b13b

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/compiletest/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
3333
let error_tag = ~"//~";
3434
let mut idx;
3535
match str::find_str(line, error_tag) {
36-
option::None => return ~[],
37-
option::Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
36+
None => return ~[],
37+
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
3838
}
3939

4040
// "//~^^^ kind msg" denotes a message expected

src/compiletest/header.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ fn load_props(testfile: &Path) -> test_props {
3434
let mut error_patterns = ~[];
3535
let mut aux_builds = ~[];
3636
let mut exec_env = ~[];
37-
let mut compile_flags = option::None;
38-
let mut pp_exact = option::None;
37+
let mut compile_flags = None;
38+
let mut pp_exact = None;
3939
for iter_header(testfile) |ln| {
4040
match parse_error_pattern(ln) {
41-
option::Some(ep) => error_patterns.push(ep),
42-
option::None => ()
41+
Some(ep) => error_patterns.push(ep),
42+
None => ()
4343
};
4444

4545
if compile_flags.is_none() {
@@ -124,12 +124,12 @@ fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
124124

125125
fn parse_pp_exact(line: ~str, testfile: &Path) -> Option<Path> {
126126
match parse_name_value_directive(line, ~"pp-exact") {
127-
option::Some(s) => option::Some(Path(s)),
128-
option::None => {
127+
Some(s) => Some(Path(s)),
128+
None => {
129129
if parse_name_directive(line, ~"pp-exact") {
130-
option::Some(testfile.file_path())
130+
Some(testfile.file_path())
131131
} else {
132-
option::None
132+
None
133133
}
134134
}
135135
}
@@ -143,12 +143,12 @@ fn parse_name_value_directive(line: ~str,
143143
directive: ~str) -> Option<~str> unsafe {
144144
let keycolon = directive + ~":";
145145
match str::find_str(line, keycolon) {
146-
option::Some(colon) => {
146+
Some(colon) => {
147147
let value = str::slice(line, colon + str::len(keycolon),
148148
str::len(line));
149149
debug!("%s: %s", directive, value);
150-
option::Some(value)
150+
Some(value)
151151
}
152-
option::None => option::None
152+
None => None
153153
}
154154
}

src/compiletest/runtest.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
117117
} else { logv(config, ~"testing for converging pretty-printing"); }
118118

119119
let rounds =
120-
match props.pp_exact { option::Some(_) => 1, option::None => 2 };
120+
match props.pp_exact { Some(_) => 1, None => 2 };
121121

122122
let mut srcs = ~[io::read_whole_file_str(testfile).get()];
123123

@@ -137,11 +137,11 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
137137

138138
let mut expected =
139139
match props.pp_exact {
140-
option::Some(file) => {
140+
Some(file) => {
141141
let filepath = testfile.dir_path().push_rel(&file);
142142
io::read_whole_file_str(&filepath).get()
143143
}
144-
option::None => { srcs[vec::len(srcs) - 2u] }
144+
None => { srcs[vec::len(srcs) - 2u] }
145145
};
146146
let mut actual = srcs[vec::len(srcs) - 1u];
147147

@@ -165,7 +165,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
165165

166166
fn print_source(config: config, testfile: &Path, src: ~str) -> procres {
167167
compose_and_run(config, testfile, make_pp_args(config, testfile),
168-
~[], config.compile_lib_path, option::Some(src))
168+
~[], config.compile_lib_path, Some(src))
169169
}
170170

171171
fn make_pp_args(config: config, _testfile: &Path) -> procargs {
@@ -199,7 +199,7 @@ actual:\n\
199199
compose_and_run_compiler(
200200
config, props, testfile,
201201
make_typecheck_args(config, testfile),
202-
option::Some(src))
202+
Some(src))
203203
}
204204

205205
fn make_typecheck_args(config: config, testfile: &Path) -> procargs {
@@ -418,7 +418,7 @@ fn exec_compiled_test(config: config, props: test_props,
418418
compose_and_run(config, testfile,
419419
make_run_args(config, props, testfile),
420420
props.exec_env,
421-
config.run_lib_path, option::None)
421+
config.run_lib_path, None)
422422
}
423423

424424
fn compose_and_run_compiler(
@@ -441,7 +441,7 @@ fn compose_and_run_compiler(
441441
make_compile_args(config, props, ~[~"--lib"] + extra_link_args,
442442
|a,b| make_lib_name(a, b, testfile), &abs_ab);
443443
let auxres = compose_and_run(config, &abs_ab, aux_args, ~[],
444-
config.compile_lib_path, option::None);
444+
config.compile_lib_path, None);
445445
if auxres.status != 0 {
446446
fatal_procres(
447447
fmt!("auxiliary build of %s failed to compile: ",
@@ -501,8 +501,8 @@ fn make_run_args(config: config, _props: test_props, testfile: &Path) ->
501501
// then split apart its command
502502
let runtool =
503503
match config.runtool {
504-
option::Some(s) => option::Some(s),
505-
option::None => option::None
504+
Some(s) => Some(s),
505+
None => None
506506
};
507507
split_maybe_args(runtool)
508508
};
@@ -517,8 +517,8 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
517517
}
518518

519519
match argstr {
520-
option::Some(s) => rm_whitespace(str::split_char(s, ' ')),
521-
option::None => ~[]
520+
Some(s) => rm_whitespace(str::split_char(s, ' ')),
521+
None => ~[]
522522
}
523523
}
524524

src/compiletest/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ fn make_new_path(path: ~str) -> ~str {
1717
// Windows just uses PATH as the library search path, so we have to
1818
// maintain the current value while adding our own
1919
match getenv(lib_path_env_var()) {
20-
option::Some(curr) => {
20+
Some(curr) => {
2121
fmt!("%s%s%s", path, path_div(), curr)
2222
}
23-
option::None => path
23+
None => path
2424
}
2525
}
2626

0 commit comments

Comments
 (0)