organic/tests/test_template

73 lines
2.8 KiB
Plaintext
Raw Normal View History

2023-09-29 20:37:22 +00:00
// TODO: Investigate writing a proc macro to make specifying these combinations easier. For example, currently I am only setting 1 setting per test to keep the repetition reasonable when I should be mixing all the different combinations.
2023-09-29 19:47:58 +00:00
{expect_fail}
2023-10-14 22:25:26 +00:00
#[tokio::test]
async fn autogen_default_{name}() -> Result<(), Box<dyn std::error::Error>> {{
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
2023-10-15 19:15:38 +00:00
assert!(organic::compare::run_anonymous_compare(org_contents.as_str()).await?);
Ok(())
}}
{expect_fail}
2023-10-14 22:25:26 +00:00
#[tokio::test]
async fn autogen_la_{name}() -> Result<(), Box<dyn std::error::Error>> {{
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
2023-10-16 23:12:25 +00:00
let global_settings = organic::settings::GlobalSettings {{
list_allow_alphabetical: true,
..Default::default()
}};
2023-10-15 19:15:38 +00:00
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
Ok(())
}}
2023-09-29 19:47:58 +00:00
{expect_fail}
2023-10-14 22:25:26 +00:00
#[tokio::test]
async fn autogen_t1_{name}() -> Result<(), Box<dyn std::error::Error>> {{
2023-09-29 19:47:58 +00:00
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
2023-10-16 23:12:25 +00:00
let global_settings = organic::settings::GlobalSettings {{
tab_width: 1,
..Default::default()
2023-09-29 19:47:58 +00:00
}};
2023-10-15 19:15:38 +00:00
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
2023-09-29 19:47:58 +00:00
Ok(())
}}
{expect_fail}
2023-10-14 22:25:26 +00:00
#[tokio::test]
async fn autogen_t16_{name}() -> Result<(), Box<dyn std::error::Error>> {{
2023-09-29 19:47:58 +00:00
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
2023-10-16 23:12:25 +00:00
let global_settings = organic::settings::GlobalSettings {{
tab_width: 16,
..Default::default()
2023-09-29 19:47:58 +00:00
}};
2023-10-15 19:15:38 +00:00
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
2023-09-29 19:47:58 +00:00
Ok(())
}}
2023-09-29 20:37:22 +00:00
{expect_fail}
2023-10-14 22:25:26 +00:00
#[tokio::test]
async fn autogen_odd_{name}() -> Result<(), Box<dyn std::error::Error>> {{
2023-09-29 20:37:22 +00:00
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
2023-10-16 23:12:25 +00:00
let global_settings = organic::settings::GlobalSettings {{
odd_levels_only: organic::settings::HeadlineLevelFilter::Odd,
..Default::default()
2023-09-29 20:37:22 +00:00
}};
2023-10-15 19:15:38 +00:00
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
2023-09-29 20:37:22 +00:00
Ok(())
}}
2023-12-30 00:07:07 +00:00
#[cfg(feature = "wasm_test")]
{expect_fail}
#[tokio::test]
async fn autogen_wasm_{name}() -> Result<(), Box<dyn std::error::Error>> {{
let org_path = "{path}";
let org_contents = std::fs::read_to_string(org_path).expect("Read org file.");
assert!(organic::wasm_test::wasm_run_anonymous_compare(org_contents.as_str()).await?);
Ok(())
}}