summaryrefslogtreecommitdiff
path: root/src/tests/locations.rs
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-08 22:01:30 -0400
committerpommicket <pommicket@gmail.com>2025-09-08 22:01:30 -0400
commite3a4ef53a75bc10129010cf18fb7ce68a6acbf2a (patch)
tree6d7aeabe48ca02f0f83ac6a59178f9b7ca6aadac /src/tests/locations.rs
parentaf57af207e5106a47e50ae1ca6de7f746cfe8da6 (diff)
Add iter(), more tests
Diffstat (limited to 'src/tests/locations.rs')
-rw-r--r--src/tests/locations.rs24
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(())
+ })
+}