Add support for marking integration tests as expected to fail.

This commit is contained in:
Tom Alexander 2023-04-19 14:40:10 -04:00
parent c6fd04e9ce
commit 35aab10155
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -22,17 +22,28 @@ fn main() {
.unwrap_or(false)
}
Err(_) => true,
}).collect::<Result<Vec<_>, _>>().unwrap();
})
.collect::<Result<Vec<_>, _>>()
.unwrap();
for test in test_files {
write_test(&mut test_file, &test);
}
}
fn write_test(test_file: &mut File, test: &walkdir::DirEntry) {
let test_name = test.path().strip_prefix("org_mode_samples/").expect("Paths should be under org_mode_samples/").to_string_lossy().to_lowercase().strip_suffix(".org").expect("Should have .org extension").replace("/", "_");
let test_name = test
.path()
.strip_prefix("org_mode_samples/")
.expect("Paths should be under org_mode_samples/")
.to_string_lossy()
.to_lowercase()
.strip_suffix(".org")
.expect("Should have .org extension")
.replace("/", "_");
if let Some(reason) = is_expect_fail(test_name.as_str()) {
write!(test_file, "#[ignore]\n").unwrap();
}
write!(
test_file,
include_str!("./tests/test_template"),
@ -56,3 +67,10 @@ use organic::sexp;
)
.unwrap();
}
fn is_expect_fail(name: &str) -> Option<&str> {
match name {
"drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."),
_ => None,
}
}