From c2903b072607d98cfa59c777d1a40b916bf4a9fc Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Sun, 17 Nov 2024 16:21:11 -0800 Subject: [PATCH] test: skipping methods by name --- src/visit.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/visit.rs b/src/visit.rs index 64c93d46..8c5e7df9 100644 --- a/src/visit.rs +++ b/src/visit.rs @@ -1013,4 +1013,27 @@ mod test { // The main fn plus two mutations of the `*` expression. assert_eq!(mutants.len(), 3); } + + #[test] + fn skip_method_calls_by_name() { + let options = Options::from_arg_strs(["mutants", "--skip-calls", "dont_touch_this"]); + let mutants = mutate_source_str( + indoc! {" + fn main() { + let mut v = V::new(); + v.dont_touch_this(2 + 3); + } + "}, + &options, + ) + .unwrap(); + dbg!(&mutants); + assert_eq!( + mutants + .iter() + .filter(|mutant| mutant.genre != Genre::FnValue) + .count(), + 0 + ); + } }