Stop using old_path in contenttest.

This commit is contained in:
Ms2ger 2015-03-26 09:16:00 +01:00
parent 385e472ca0
commit e2c03510de

View file

@ -11,7 +11,6 @@
#![feature(core)]
#![feature(exit_status)]
#![feature(old_io)]
#![feature(old_path)]
#![feature(path)]
#![feature(rustc_private)]
#![feature(std_misc)]
@ -24,10 +23,10 @@ use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynT
use test::ShouldPanic;
use getopts::{getopts, reqopt};
use std::{str, env};
use std::old_io::fs;
use std::ffi::OsStr;
use std::fs::read_dir;
use std::old_io::Reader;
use std::old_io::process::{Command, Ignored, CreatePipe, InheritFd, ExitStatus};
use std::old_path::Path;
use std::thunk::Thunk;
#[derive(Clone)]
@ -75,13 +74,14 @@ fn test_options(config: Config) -> TestOpts {
}
fn find_tests(config: Config) -> Vec<TestDescAndFn> {
let files_res = fs::readdir(&Path::new(config.source_dir));
let mut files = match files_res {
Ok(files) => files,
_ => panic!("Error reading directory."),
};
files.retain(|file| file.extension_str() == Some("html") );
return files.iter().map(|file| make_test(file.display().to_string())).collect();
read_dir(&config.source_dir)
.ok()
.expect("Error reading directory.")
.filter_map(Result::ok)
.map(|e| e.path())
.filter(|file| file.extension().map_or(false, |e| e == OsStr::from_str("html")))
.map(|file| make_test(file.display().to_string()))
.collect()
}
fn make_test(file: String) -> TestDescAndFn {