replace_return_value: Replace the value in explicit return() calls

View source: R/mutator-return.R

replace_return_valueR Documentation

Replace the value in explicit return() calls

Description

Replaces 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.

Usage

replace_return_value(replacement = "NULL")

Arguments

replacement

Raw R source text to substitute as the return value. Defaults to "NULL". Examples: "NA" inserts the missing value NA; '"NULL"' (inner quotes) inserts the string "NULL"; '"NA"' inserts the string "NA" rather than the missing value.

Details

Only explicit return() calls are targeted. Implicit returns (the last expression of a function body) are not affected.

Value

A Mutator object.

Examples

replace_return_value()
replace_return_value("NA")

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