From 2c457b4181340fb078ada4d8de505adb2d0f273c Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 4 Apr 2021 12:57:08 -0600 Subject: add a unit test for `%`-matching in inference rules --- src/makefile/inference_rules.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/makefile/inference_rules.rs b/src/makefile/inference_rules.rs index 7a636df..86e5598 100644 --- a/src/makefile/inference_rules.rs +++ b/src/makefile/inference_rules.rs @@ -77,4 +77,21 @@ mod test { assert!(rule.matches("dir/foo.o")?); Ok(()) } + + #[cfg(feature = "full")] + #[test] + fn percent_match() -> R { + // thanks, SPDX License List + let rule = InferenceRule { + products: vec!["licenseListPublisher-%.jar-valid".to_owned()], + prerequisites: vec![ + "licenseListPublisher-%.jar.asc".to_owned(), + "licenseListPublisher-%.jar".to_owned(), + "goneall.gpg".to_owned(), + ], + commands: vec![], + }; + assert!(rule.matches("licenseListPublisher-2.2.1.jar-valid")?); + Ok(()) + } } -- cgit v1.2.3