
String literal mutators
string_literals.RdReturns a ready-made list of string_empty() and string_fill() mutators
covering both directions: collapsing non-empty strings to "" and filling
empty strings with a placeholder.
Details
Use on any file where string values are passed to downstream logic or returned to callers. Surviving mutants reveal tests that only check type or length — asserting the exact string content kills them.
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
string_literals()
#> [[1]]
#> Mutator: <non-empty string> → ""
#> Query: (string) @value
#>
#> [[2]]
#> Mutator: "" → "mutant"
#> Query: (string) @value
#>
if (FALSE) { # \dontrun{
plan <- muttest_plan(
source_files = "R/labels.R",
mutators = string_literals()
)
muttest(plan, "tests/testthat")
} # }