index_mutations: Index mutation mutators

View source: R/mutator-presets.R

index_mutationsR Documentation

Index mutation mutators

Description

Returns a ready-made list of index_increment() and index_decrement() mutators that shift every simple subscript index by 1.

Usage

index_mutations()

Details

Use on any file that extracts elements from vectors or lists by position. Surviving mutants reveal off-by-one errors where tests only verify that something was extracted, not which element — asserting the exact value of the extracted element kills them.

Value

A list of mutators.

See Also

vignette("mutators", package = "muttest") for the full mutator table.

vignette("interpreting-results", package = "muttest") for how to diagnose survivors and fix the underlying test weakness.

Examples

index_mutations()

## Not run: 
plan <- muttest_plan(
  source_files = "R/selectors.R",
  mutators = index_mutations()
)
muttest(plan, "tests/testthat")

## End(Not run)

muttest documentation built on May 14, 2026, 5:10 p.m.