use crate::Configuration;
#[test]
fn locations() {
super::do_tests_in_dir("location", ".locations.pom", |filename| {
let locations = Configuration::load_path(filename)?;
let config = Configuration::load_path(&filename.replace(".locations.pom", ".pom"))?;
for (key, val) in &locations {
let location = config.location(key).ok_or_else(|| {
format!("key {key} not found in main config but it exists in the location's config")
})?;
let got = location.line();
let expected = val
.parse()
.map_err(|_| format!("key {key} in location POM should be an integer"))?;
if got != expected {
Err(format!(
"key {key} reported as being at line {got}, but it should be at line {expected}"
))?;
}
}
Ok(())
})
}