Skip to content
mutastic

Swift edition

Calls and writes

Operators that leave something out: a call, an assignment or a write to a property. They ask whether a test notices the side effect, not only the return value.

OperatorChangesSet
mutastic/remove-void-calla call whose result isn’t used, left outdefaults
mutastic/remove-discarded-call_ = call() left outdefaults
mutastic/remove-assignmentan assignment to a local left outdefaults
mutastic/remove-field-writean assignment to a property left outstronger

The mutants each makes, on samples/operators/Sources/Operators/Calls.swift:

Terminal window
mutastic mutants samples/operators --at=Sources/Operators/Calls.swift:1-99 --operators=mutastic/remove-void-call,mutastic/remove-discarded-call,mutastic/remove-assignment,mutastic/remove-field-write
Terminal window
m1c3623af Sources/Operators/Calls.swift:10:5 mutastic/remove-void-call items.append(item) is removed in Basket.add
mf973a79e Sources/Operators/Calls.swift:22:5 mutastic/remove-discarded-call _ = visit() is removed in Basket.addOnVisit
m156490fb Sources/Operators/Calls.swift:23:5 mutastic/remove-void-call add(item) is removed in Basket.addOnVisit
m4edb9aa5 Sources/Operators/Calls.swift:28:5 mutastic/remove-field-write items = [] is removed in Basket.clear
mb195cb7d Sources/Operators/Calls.swift:34:5 mutastic/remove-assignment paid = total + tip is removed in Basket.withTip
no estimate: no run is recorded here yet; run once to get estimates, or add --estimate
5 mutants

mutastic/remove-void-call, in the defaults. A call made for what it does, whose result nothing uses, is removed. A call a block needs to compile, one that never returns or one that’s all a closure or a getter gives back, isn’t.

mutastic/remove-discarded-call, in the defaults. A call whose result is thrown away with _ = is removed.

mutastic/remove-assignment, in the defaults. An assignment to a local variable is removed, other than its first value, which the code needs to compile.

mutastic/remove-field-write, in stronger. An assignment to a property is removed, other than one an initializer must make.