From e3a4ef53a75bc10129010cf18fb7ce68a6acbf2a Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 8 Sep 2025 22:01:30 -0400 Subject: Add iter(), more tests --- src/tests/locations.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/tests/locations.rs (limited to 'src/tests/locations.rs') 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(()) + }) +} -- cgit v1.2.3