aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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(())
+ }
+}