Strip prefix from file path.
This commit is contained in:
parent
f43920fc7c
commit
92afdc0ea6
@ -1,12 +1,10 @@
|
|||||||
#![feature(round_char_boundary)]
|
#![feature(round_char_boundary)]
|
||||||
#![feature(exact_size_is_empty)]
|
#![feature(exact_size_is_empty)]
|
||||||
use std::io::Read;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use futures::future::BoxFuture;
|
use futures::future::BoxFuture;
|
||||||
use futures::future::FutureExt;
|
use futures::future::FutureExt;
|
||||||
use organic::compare::run_compare_on_file;
|
|
||||||
use organic::compare::silent_compare_on_file;
|
use organic::compare::silent_compare_on_file;
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use tokio::task::JoinError;
|
use tokio::task::JoinError;
|
||||||
@ -85,14 +83,23 @@ fn compare_all_org_document<P: AsRef<Path>>(root_dir: P) -> impl Iterator<Item =
|
|||||||
})
|
})
|
||||||
.collect::<Result<Vec<_>, _>>()
|
.collect::<Result<Vec<_>, _>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let test_configs = test_files.into_iter().map(|test_file| {
|
let test_configs: Vec<_> = test_files
|
||||||
let name = test_file.path().as_os_str().to_string_lossy().into_owned();
|
.into_iter()
|
||||||
TestConfig::SingleFile(SingleFile {
|
.map(|test_file| {
|
||||||
name,
|
let name = test_file
|
||||||
file_path: test_file.into_path(),
|
.path()
|
||||||
|
.strip_prefix(root_dir)
|
||||||
|
.expect("Result is from walkdir so it must be below the root directory.")
|
||||||
|
.as_os_str()
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned();
|
||||||
|
TestConfig::SingleFile(SingleFile {
|
||||||
|
name,
|
||||||
|
file_path: test_file.into_path(),
|
||||||
|
})
|
||||||
})
|
})
|
||||||
});
|
.collect();
|
||||||
test_configs
|
test_configs.into_iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
static TEST_PERMITS: Semaphore = Semaphore::const_new(8);
|
static TEST_PERMITS: Semaphore = Semaphore::const_new(8);
|
||||||
|
Loading…
Reference in New Issue
Block a user