na_literals: NA and NULL literal mutators

View source: R/mutator-presets.R

na_literalsR Documentation

NA and NULL literal mutators

Description

Returns a ready-made list of na_literal() mutators covering common swaps between NA, NULL, and the typed NA variants (NA_real_, NA_integer_, NA_character_).

Usage

na_literals()

Details

Use on any file that handles missing values or nullable results. A surviving mutant typically means tests never distinguish NA from NULL, or never check which typed NA is returned — adding expect_true(is.na(x)) and expect_equal(class(x), "numeric") style assertions kills it.

Value

A list of na_literal() 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

na_literals()

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

## End(Not run)

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