From c4d2941cbf938dae1d10dbbd18c214c2fd55f84b Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Sat, 14 Mar 2026 23:33:48 +0000 Subject: [PATCH] Add Span::contains and use for effect validation --- crates/bough-core/src/mutant.rs | 6 +++++- examples/vitest-complex/bough.toml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/bough-core/src/mutant.rs b/crates/bough-core/src/mutant.rs index 68285603..925c06ce 100644 --- a/crates/bough-core/src/mutant.rs +++ b/crates/bough-core/src/mutant.rs @@ -84,7 +84,7 @@ impl Mutant { inner: inner.twig.clone(), }); } - Ok(self.effect_span.intersects(&inner.subst_span)) + Ok(self.effect_span.contains(&inner.subst_span)) } pub fn get_contextual_fragment( @@ -272,6 +272,10 @@ impl Span { pub fn intersects(&self, other: &Span) -> bool { self.start.byte < other.end.byte && other.start.byte < self.end.byte } + + pub fn contains(&self, inner: &Span) -> bool { + self.start.byte <= inner.start.byte && inner.end.byte <= self.end.byte + } } // bough[impl point.line] diff --git a/examples/vitest-complex/bough.toml b/examples/vitest-complex/bough.toml index 0eefced8..8fef64ad 100644 --- a/examples/vitest-complex/bough.toml +++ b/examples/vitest-complex/bough.toml @@ -7,6 +7,8 @@ init.cmd = "npm install" test.cmd = "npm run test" [find] +number = 8 +number_per_file = 4 factors = [ "EncompasingMissedMutationsCount", "TSNodeDepth", -- knotmirror 0.0.1