diff options
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/compiletest.rs | 14 | ||||
| -rw-r--r-- | src/compiletest/errors.rs | 10 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 12 | ||||
| -rw-r--r-- | src/compiletest/procsrv.rs | 10 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 44 |
5 files changed, 45 insertions, 45 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 06428a993d2..07bb35dc292 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -21,13 +21,13 @@ import common::mode_pretty; import common::mode; import util::logv; -fn main(args: [str]) { +fn main(args: [str]/~) { let config = parse_config(args); log_config(config); run_tests(config); } -fn parse_config(args: [str]) -> config { +fn parse_config(args: [str]/~) -> config { let opts = [getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"), getopts::reqopt("rustc-path"), getopts::reqopt("src-base"), @@ -36,7 +36,7 @@ fn parse_config(args: [str]) -> config { getopts::reqopt("mode"), getopts::optflag("ignored"), getopts::optopt("runtool"), getopts::optopt("rustcflags"), getopts::optflag("verbose"), - getopts::optopt("logfile")]; + getopts::optopt("logfile")]/~; check (vec::is_not_empty(args)); let args_ = vec::tail(args); @@ -132,9 +132,9 @@ fn test_opts(config: config) -> test::test_opts { } } -fn make_tests(config: config) -> [test::test_desc] { +fn make_tests(config: config) -> [test::test_desc]/~ { #debug("making tests from %s", config.src_base); - let mut tests = []; + let mut tests = []/~; for os::list_dir_path(config.src_base).each {|file| let file = file; #debug("inspecting file %s", file); @@ -148,8 +148,8 @@ 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"] } }; - let invalid_prefixes = [".", "#", "~"]; + alt config.mode { mode_pretty { [".rs"]/~ } _ { [".rc", ".rs"]/~ } }; + let invalid_prefixes = [".", "#", "~"]/~; let name = path::basename(testfile); let mut valid = false; diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 1e04eb52109..5d1bba368d4 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -8,8 +8,8 @@ export expected_error; type expected_error = { line: uint, kind: str, msg: str }; // Load any test directives embedded in the file -fn load_errors(testfile: str) -> [expected_error] { - let mut error_patterns = []; +fn load_errors(testfile: str) -> [expected_error]/~ { + let mut error_patterns = []/~; let rdr = result::get(io::file_reader(testfile)); let mut line_num = 1u; while !rdr.eof() { @@ -20,11 +20,11 @@ fn load_errors(testfile: str) -> [expected_error] { ret error_patterns; } -fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe { +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 { ret []; } + option::none { ret []/~; } option::some(nn) { idx = (nn as uint) + str::len(error_tag); } } @@ -49,5 +49,5 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe { #debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg); - ret [{line: line_num - adjust_line, kind: kind, msg: msg}]; + ret [{line: line_num - adjust_line, kind: kind, msg: msg}]/~; } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 642e2073e6b..7d286211acb 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -10,23 +10,23 @@ export is_test_ignored; type test_props = { // Lines that should be expected, in order, on standard out - error_patterns: [str], + error_patterns: [str]/~, // Extra flags to pass to the compiler compile_flags: option<str>, // If present, the name of a file that this test should match when // pretty-printed pp_exact: option<str>, // Modules from aux directory that should be compiled - aux_builds: [str], + aux_builds: [str]/~, // Environment settings to use during execution - exec_env: [(str,str)] + exec_env: [(str,str)]/~ }; // Load any test directives embedded in the file fn load_props(testfile: str) -> test_props { - let mut error_patterns = []; - let mut aux_builds = []; - let mut exec_env = []; + let mut error_patterns = []/~; + let mut aux_builds = []/~; + let mut exec_env = []/~; let mut compile_flags = option::none; let mut pp_exact = option::none; for iter_header(testfile) {|ln| diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 354d966c2cc..374ad1cda08 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -5,7 +5,7 @@ import libc::{c_int, pid_t}; export run; #[cfg(target_os = "win32")] -fn target_env(lib_path: str, prog: str) -> [(str,str)] { +fn target_env(lib_path: str, prog: str) -> [(str,str)]/~ { let mut env = os::env(); @@ -27,16 +27,16 @@ fn target_env(lib_path: str, prog: str) -> [(str,str)] { #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] -fn target_env(_lib_path: str, _prog: str) -> [(str,str)] { - [] +fn target_env(_lib_path: str, _prog: str) -> [(str,str)]/~ { + []/~ } // FIXME (#2659): This code is duplicated in core::run::program_output fn run(lib_path: str, prog: str, - args: [str], - env: [(str, str)], + args: [str]/~, + env: [(str, str)]/~, input: option<str>) -> {status: int, out: str, err: str} { let pipe_in = os::pipe(); diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 749af7d9f73..7d33843c0d3 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -92,7 +92,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) { let rounds = alt props.pp_exact { option::some(_) { 1 } option::none { 2 } }; - let mut srcs = [result::get(io::read_whole_file_str(testfile))]; + let mut srcs = [result::get(io::read_whole_file_str(testfile))]/~; let mut round = 0; while round < rounds { @@ -139,12 +139,12 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) { fn print_source(config: config, testfile: str, src: str) -> procres { compose_and_run(config, testfile, make_pp_args(config, testfile), - [], config.compile_lib_path, option::some(src)) + []/~, config.compile_lib_path, option::some(src)) } fn make_pp_args(config: config, _testfile: str) -> procargs { let prog = config.rustc_path; - let args = ["-", "--pretty", "normal"]; + let args = ["-", "--pretty", "normal"]/~; ret {prog: prog, args: args}; } @@ -179,7 +179,7 @@ actual:\n\ fn make_typecheck_args(config: config, testfile: str) -> procargs { let prog = config.rustc_path; let mut args = ["-", "--no-trans", "--lib", "-L", config.build_base, - "-L", aux_output_dir_name(config, testfile)]; + "-L", aux_output_dir_name(config, testfile)]/~; args += split_maybe_args(config.rustcflags); ret {prog: prog, args: args}; } @@ -227,7 +227,7 @@ fn check_error_patterns(props: test_props, } } -fn check_expected_errors(expected_errors: [errors::expected_error], +fn check_expected_errors(expected_errors: [errors::expected_error]/~, testfile: str, procres: procres) { @@ -286,13 +286,13 @@ fn check_expected_errors(expected_errors: [errors::expected_error], } } -type procargs = {prog: str, args: [str]}; +type procargs = {prog: str, args: [str]/~}; type procres = {status: int, stdout: str, stderr: str, cmdline: str}; fn compile_test(config: config, props: test_props, testfile: str) -> procres { - let link_args = ["-L", aux_output_dir_name(config, testfile)]; + let link_args = ["-L", aux_output_dir_name(config, testfile)]/~; compose_and_run_compiler( config, props, testfile, make_compile_args(config, props, link_args, @@ -319,14 +319,14 @@ fn compose_and_run_compiler( ensure_dir(aux_output_dir_name(config, testfile)); } - let extra_link_args = ["-L", aux_output_dir_name(config, testfile)]; + let extra_link_args = ["-L", aux_output_dir_name(config, testfile)]/~; vec::iter(props.aux_builds) {|rel_ab| let abs_ab = path::connect(config.aux_base, rel_ab); let aux_args = - make_compile_args(config, props, ["--lib"] + extra_link_args, + 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, [], + let auxres = compose_and_run(config, abs_ab, aux_args, []/~, config.compile_lib_path, option::none); if auxres.status != 0 { fatal_procres( @@ -335,7 +335,7 @@ fn compose_and_run_compiler( } } - compose_and_run(config, testfile, args, [], + compose_and_run(config, testfile, args, []/~, config.compile_lib_path, input) } @@ -348,19 +348,19 @@ fn ensure_dir(path: path) { fn compose_and_run(config: config, testfile: str, procargs: procargs, - procenv: [(str, str)], + procenv: [(str, str)]/~, lib_path: str, input: option<str>) -> procres { ret program_output(config, testfile, lib_path, procargs.prog, procargs.args, procenv, input); } -fn make_compile_args(config: config, props: test_props, extras: [str], +fn make_compile_args(config: config, props: test_props, extras: [str]/~, xform: fn(config, str) -> str, testfile: str) -> procargs { let prog = config.rustc_path; let mut args = [testfile, "-o", xform(config, testfile), - "-L", config.build_base] + extras; + "-L", config.build_base]/~ + extras; args += split_maybe_args(config.rustcflags); args += split_maybe_args(props.compile_flags); ret {prog: prog, args: args}; @@ -390,12 +390,12 @@ fn make_run_args(config: config, _props: test_props, testfile: str) -> split_maybe_args(runtool) }; - let args = toolargs + [make_exe_name(config, testfile)]; + let args = toolargs + [make_exe_name(config, testfile)]/~; ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))}; } -fn split_maybe_args(argstr: option<str>) -> [str] { - fn rm_whitespace(v: [str]) -> [str] { +fn split_maybe_args(argstr: option<str>) -> [str]/~ { + fn rm_whitespace(v: [str]/~) -> [str]/~ { fn flt(&&s: str) -> option<str> { if !str::is_whitespace(s) { option::some(s) } else { option::none } } @@ -404,12 +404,12 @@ fn split_maybe_args(argstr: option<str>) -> [str] { alt argstr { option::some(s) { rm_whitespace(str::split_char(s, ' ')) } - option::none { [] } + option::none { []/~ } } } fn program_output(config: config, testfile: str, lib_path: str, prog: str, - args: [str], env: [(str, str)], + args: [str]/~, env: [(str, str)]/~, input: option<str>) -> procres { let cmdline = { @@ -429,12 +429,12 @@ fn program_output(config: config, testfile: str, lib_path: str, prog: str, #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] -fn make_cmdline(_libpath: str, prog: str, args: [str]) -> str { +fn make_cmdline(_libpath: str, prog: str, args: [str]/~) -> str { #fmt["%s %s", prog, str::connect(args, " ")] } #[cfg(target_os = "win32")] -fn make_cmdline(libpath: str, prog: str, args: [str]) -> str { +fn make_cmdline(libpath: str, prog: str, args: [str]/~) -> str { #fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog, str::connect(args, " ")] } @@ -454,7 +454,7 @@ fn dump_output(config: config, testfile: str, out: str, err: str) { fn dump_output_file(config: config, testfile: str, out: str, extension: str) { let outfile = make_out_name(config, testfile, extension); let writer = result::get( - io::file_writer(outfile, [io::create, io::truncate])); + io::file_writer(outfile, [io::create, io::truncate]/~)); writer.write_str(out); } |
