
Replace the value in explicit return() calls
replace_return_value.RdReplaces the argument of every return(expr) with a fixed value (default
"NULL"). Tests that only check that a function returns something without
asserting the value will not kill these mutants.
Value
A Mutator object.
Details
Only explicit return() calls are targeted. Implicit returns (the last
expression of a function body) are not affected.
Examples
replace_return_value()
#> Mutator: return(<value>) → return(NULL)
#> Query: (call function: (return) arguments: (arguments (argument value: (_) @value)))
replace_return_value("NA")
#> Mutator: return(<value>) → return(NA)
#> Query: (call function: (return) arguments: (arguments (argument value: (_) @value)))