Start invoking the tests.
This commit is contained in:
parent
8a26965e14
commit
8271f6b44a
@ -43,22 +43,32 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
async fn main_body() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main_body() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let single_file = TestConfig::SingleFile(SingleFile {
|
let layer = compare_group("org-mode", || {
|
||||||
name: "foo".to_owned(),
|
compare_all_org_document("/foreign_documents/org-mode")
|
||||||
file_path: PathBuf::from("/tmp/test.org"),
|
|
||||||
});
|
});
|
||||||
// let result = single_file.run_test().await;
|
let layer = layer.chain(compare_group("emacs", || {
|
||||||
let result = tokio::spawn(single_file.run_test()).await;
|
compare_all_org_document("/foreign_documents/emacs")
|
||||||
println!("{:?}", result);
|
}));
|
||||||
// let test_config = TestConfig::TestLayer(TestLayer {
|
|
||||||
// name: "foo",
|
let running_tests: Vec<_> = layer.map(|c| tokio::spawn(c.run_test())).collect();
|
||||||
// children: vec![TestConfig::SingleFile(SingleFile {
|
for test in running_tests.into_iter() {
|
||||||
// file_path: Path::new("/tmp/test.org"),
|
let test_result = test.await??;
|
||||||
// })],
|
println!("{:?}", test_result);
|
||||||
// });
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn compare_group<N: Into<String>, F: Fn() -> I, I: Iterator<Item = TestConfig>>(
|
||||||
|
name: N,
|
||||||
|
inner: F,
|
||||||
|
) -> impl Iterator<Item = TestConfig> {
|
||||||
|
std::iter::once(TestConfig::TestLayer(TestLayer {
|
||||||
|
name: name.into(),
|
||||||
|
children: inner().collect(),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
fn compare_all_org_document<P: AsRef<Path>>(root_dir: P) -> impl Iterator<Item = TestConfig> {
|
fn compare_all_org_document<P: AsRef<Path>>(root_dir: P) -> impl Iterator<Item = TestConfig> {
|
||||||
let root_dir = root_dir.as_ref();
|
let root_dir = root_dir.as_ref();
|
||||||
let test_files = WalkDir::new(root_dir)
|
let test_files = WalkDir::new(root_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user