diff options
Diffstat (limited to 'src/tests/locations.rs')
-rw-r--r-- | src/tests/locations.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/locations.rs b/src/tests/locations.rs new file mode 100644 index 0000000..2310101 --- /dev/null +++ b/src/tests/locations.rs @@ -0,0 +1,24 @@ +use crate::Configuration; + +#[test] +fn parsing() { + 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(()) + }) +} |