Skip to content
mutastic

Swift edition

mutastic mutants

List the mutants, without building or running anything. One line each: its id, place, operator, the change, and the function it's in. A last lines count what was left out. With --operators, it shows what those would add before a run. With --operators and a recorded run, the line before the count estimates what the set adds to the tests' time; --estimate measures the tests first.

Usage

Terminal window
mutastic mutants [DIR]

A coding agent's hooks run it as the command: the build plugins don't.

Output

On the pricing sample. This is mutastic's own output, written from the CLI and checked against it on every build.

Terminal window
m8dfdbb10 Sources/Pricing/Pricing.swift:12:8 mutastic/remove-conditional total >= 100 is always false in Pricing.discount
mee8738a6 Sources/Pricing/Pricing.swift:12:8 mutastic/remove-conditional total >= 100 is always true in Pricing.discount
m86f9a31d Sources/Pricing/Pricing.swift:12:14 mutastic/boundary >= becomes > in Pricing.discount
mea2a2766 Sources/Pricing/Pricing.swift:13:14 mutastic/return-value returns 0 instead in Pricing.discount
ma2a96a24 Sources/Pricing/Pricing.swift:13:20 mutastic/math / becomes * in Pricing.discount
m1ac0cff7 Sources/Pricing/Pricing.swift:15:12 mutastic/return-value returns 1 instead in Pricing.discount
m369e6410 Sources/Pricing/Pricing.swift:20:8 mutastic/remove-conditional total < freeShippingFrom is always false in Pricing.shipping
m93c640fa Sources/Pricing/Pricing.swift:20:8 mutastic/remove-conditional total < freeShippingFrom is always true in Pricing.shipping
md3d5fe4b Sources/Pricing/Pricing.swift:20:14 mutastic/boundary < becomes <= in Pricing.shipping
m687f3e5e Sources/Pricing/Pricing.swift:21:14 mutastic/return-value returns 0 instead in Pricing.shipping
m72279fbc Sources/Pricing/Pricing.swift:23:12 mutastic/return-value returns 1 instead in Pricing.shipping
11 mutants

Exit status

0 once they're listed. Any command exits 2 when mutastic couldn't run: see exit codes.

Options

--at=PATH:LINE

Run, or list, only the mutants on a line of a source file, or with :FROM-TO on those lines, under the run's operators; several split by commas. The run passes when each is caught or skipped.

Command line--at=PATH:LINE

--build-system=BUILD

Which build a directory with both a Package.swift and an Xcode project uses: the one with tests unless set, and a refusal when both have them.

One of swiftpmxcode

Command line--build-system=BUILD

--scheme=SCHEME

The Xcode scheme whose tests a run uses, for a project or workspace with several: the only one with tests for macOS or iOS unless set.

Command line--scheme=SCHEME

--operators=OPERATORS

Which operators run: a set (defaults, stronger, extended or all), an operator's id or namespace, or any with - in front to leave it out, in place of mutastic.yaml's operators; defaults unless set.

Command line--operators=OPERATORS

--estimate

Run every test once, with no mutant in, and estimate what defaults, stronger and all would take.

Command line--estimate