aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-04 11:55:30 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-04 11:55:30 -0600
commit8b4e33220d3ca9a929e485388b73630883394fe6 (patch)
tree2640b27012f2b68c34fef6d67975fef2472431a5
parent0a7919737e55c2bd5e87698f10717501e850f0d7 (diff)
downloadmakers-8b4e33220d3ca9a929e485388b73630883394fe6.tar.gz
makers-8b4e33220d3ca9a929e485388b73630883394fe6.zip
add a test for suffix rule matching
-rw-r--r--src/makefile/inference_rules.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/makefile/inference_rules.rs b/src/makefile/inference_rules.rs
index ed83f03..7a636df 100644
--- a/src/makefile/inference_rules.rs
+++ b/src/makefile/inference_rules.rs
@@ -63,3 +63,18 @@ impl fmt::Display for InferenceRule {
Ok(())
}
}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ type R = eyre::Result<()>;
+
+ #[test]
+ fn suffix_match() -> R {
+ let rule = InferenceRule::new_suffix(".o".to_string(), ".c".to_string(), vec![]);
+ assert!(rule.matches("foo.o")?);
+ assert!(rule.matches("dir/foo.o")?);
+ Ok(())
+ }
+}