From 35aab10155b2c1387c75c6196e5e9718749178ea Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 19 Apr 2023 14:40:10 -0400 Subject: [PATCH] Add support for marking integration tests as expected to fail. --- build.rs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 3a56b09..4681b90 100644 --- a/build.rs +++ b/build.rs @@ -22,17 +22,28 @@ fn main() { .unwrap_or(false) } Err(_) => true, - }).collect::, _>>().unwrap(); + }) + .collect::, _>>() + .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, + } +}