use crate::Configuration; static TEST_DIR: &str = "../tests/parsing"; fn single_test(flat_name: &str, complex_name: &str) -> Result<(), Box> { let config1 = Configuration::load_path(format!("{TEST_DIR}/{flat_name}"))?; let config2 = Configuration::load_path(format!("{TEST_DIR}/{complex_name}"))?; super::check_configs_equal(&config1, &config2) } fn try_parsing() -> Result<(), Box> { let tests = std::fs::read_dir(TEST_DIR).map_err(|e| { format!( "error reading {TEST_DIR}: {e} — try moving pom-rs to inside the main pom repository?" ) })?; for test_entry in tests { let filename = test_entry .map_err(|e| format!("error reading tests directory {TEST_DIR}: {e}"))? .file_name() .into_string() .expect("bad UTF-8 in test name (file in {TEST_DIR})"); if filename.ends_with(".flat.pom") { single_test(&filename, filename.replace(".flat.pom", ".pom").as_ref())?; } } Ok(()) } #[test] fn parsing() { if let Err(e) = try_parsing() { panic!("Error: {e}"); } }