organic/tests/test_template
Tom Alexander dea3721b1c
Some checks failed
rustfmt Build rustfmt has succeeded
rust-build Build rust-build has succeeded
rust-foreign-document-test Build rust-foreign-document-test has failed
rust-test Build rust-test has succeeded
Fix reporting errors in tests.
2023-10-15 15:16:06 -04:00

67 lines
2.7 KiB
Plaintext

// 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.
{expect_fail}
#[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.");
assert!(organic::compare::run_anonymous_compare(org_contents.as_str()).await?);
Ok(())
}}
{expect_fail}
#[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.");
let global_settings = {{
let mut global_settings = organic::settings::GlobalSettings::default();
global_settings.list_allow_alphabetical = true;
global_settings
}};
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
Ok(())
}}
{expect_fail}
#[tokio::test]
async fn autogen_t1_{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.");
let global_settings = {{
let mut global_settings = organic::settings::GlobalSettings::default();
global_settings.tab_width = 1;
global_settings
}};
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
Ok(())
}}
{expect_fail}
#[tokio::test]
async fn autogen_t16_{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.");
let global_settings = {{
let mut global_settings = organic::settings::GlobalSettings::default();
global_settings.tab_width = 16;
global_settings
}};
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
Ok(())
}}
{expect_fail}
#[tokio::test]
async fn autogen_odd_{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.");
let global_settings = {{
let mut global_settings = organic::settings::GlobalSettings::default();
global_settings.odd_levels_only = organic::settings::HeadlineLevelFilter::Odd;
global_settings
}};
assert!(organic::compare::run_anonymous_compare_with_settings(org_contents.as_str(), &global_settings, false).await?);
Ok(())
}}