diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml index 03c3591..981cbee 100644 --- a/.cargo/mutants.toml +++ b/.cargo/mutants.toml @@ -7,6 +7,12 @@ test_tool = "nextest" # Async tests + crypto work takes longer under mutation load. timeout_multiplier = 3.0 +# Enable `test-support` so cfg-gated setters (e.g. Builder::dht_backend) and +# the integration tests that exercise them are part of the mutation surface. +# Without this, dht_backend mutations always "survive" trivially because the +# method isn't compiled in. +additional_cargo_args = ["--features", "test-support"] + # Skip paths that either can't be meaningfully mutated or are covered by # other tools: # - sim_impl.rs: simulator is exercised via the simulator example, not diff --git a/src/builder.rs b/src/builder.rs index b369e09..0dd5589 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -470,6 +470,28 @@ mod tests { assert_eq!(Builder::default().heal_period(d).heal_period, d); } + #[test] + fn failure_retry_period_setter_stores_exact_value() { + let d = Duration::from_millis(42); + assert_eq!( + Builder::default().failure_retry_period(d).failure_retry_period, + d + ); + } + + #[test] + #[cfg(feature = "test-support")] + fn dht_backend_setter_stores_value() { + use std::sync::Arc; + + use crate::sim::InMemoryDht; + let dht = Arc::new(InMemoryDht::new()); + let before = Builder::default(); + let after = Builder::default().dht_backend(dht); + assert!(before.dht_backend.is_none()); + assert!(after.dht_backend.is_some()); + } + #[test] fn jitter_setter_stores_exact_value() { let b = Builder::default().jitter(0.25);