diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index a2f36c104a0a2..45d552dc9232c 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -24,6 +24,7 @@ use std::io; use std::os; use std::uint; use std::vec; +use std::str; use extra::test::MetricMap; @@ -355,6 +356,30 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], fmt!("%s:%u:", testfile.to_str(), ee.line) }).collect::<~[~str]>(); + fn to_lower( s : &str ) -> ~str { + let i = s.iter(); + let c : ~[char] = i.transform( |c| { + if c.is_ascii() { + c.to_ascii().to_lower().to_char() + } else { + c + } + } ).collect(); + str::from_chars( c ) + } + + #[cfg(target_os = "win32")] + fn prefix_matches( line : &str, prefix : &str ) -> bool { + to_lower(line).starts_with( to_lower(prefix) ) + } + + #[cfg(target_os = "linux")] + #[cfg(target_os = "macos")] + #[cfg(target_os = "freebsd")] + fn prefix_matches( line : &str, prefix : &str ) -> bool { + line.starts_with( prefix ) + } + // Scan and extract our error/warning messages, // which look like: // filename:line1:col1: line2:col2: *error:* msg @@ -367,7 +392,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], if !found_flags[i] { debug!("prefix=%s ee.kind=%s ee.msg=%s line=%s", prefixes[i], ee.kind, ee.msg, line); - if (line.starts_with(prefixes[i]) && + if ( prefix_matches(line, prefixes[i]) && line.contains(ee.kind) && line.contains(ee.msg)) { found_flags[i] = true; @@ -681,7 +706,7 @@ fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path { } fn aux_output_dir_name(config: &config, testfile: &Path) -> Path { - output_base_name(config, testfile).with_filetype("libaux") + Path(output_base_name(config, testfile).to_str() + ".libaux") } fn output_testname(testfile: &Path) -> Path {