Skip to content
mutastic

Swift edition

mutastic for Swift: the docs

mutastic changes your code in small ways, such as >= to >, and runs your tests against each change. A change no test notices is a gap: code your tests run but don’t check. For each one, mutastic shows the line, the change and the tests that ran it, says what a test would need to check, and gives the command that proves the gap is closed.

These pages are the Swift edition’s. They’re written to move into the Swift section of docs.mutastic.io when the site publishes it, so each page stands alone and links to the others by relative path. The Swift edition isn’t released yet: it’s planned for mutastic 1.5.0, and what needs that release says “from 1.5.0”.

  • Getting started: install it, run it on a package, read the first card, write the test, and prove it.
  • Installing mutastic: what you need, building and installing it from source, and how mutastic finds it.
  • Running on your project: SwiftPM packages and Xcode projects, Swift Testing and XCTest, macOS and Linux, build arguments, and where its files go.
  • Running in CI: fail the build on a low score, check only a pull request’s lines, keep the build between runs, split a run across jobs, and keep the reports.
  • How the tests are run: one build for every mutant, mutants that don’t compile, crashes, time limits, and tests that depend on their order.
  • Equivalent mutants: the mutants no test can catch, which mutastic skips on its own and why, and how to record one it can’t tell.
  • Mutant ids: what an id is made of, what keeps it while you work, and what makes a new one.
  • Xcode projects: which scheme and platform a run uses, and what mutastic changes about the build.
  • Coverage and mutants: one example measured both ways, the same coverage for tests that check and tests that don’t, and what mutants find past it.
  • Results and the score: what happens to a mutant, how a test catches one, how the score is worked out, and why some mutants are skipped.
  • Suggested tests: the inputs your tests used, the test mutastic writes for a missed mutant, and the assertion it starts an untested function with.
  • Commands: each with every option it takes, and environment and exit codes.
  • Errors: what a mistake on the command line says, and the command it offers instead.
  • Arid rules: the code mutastic skips on its own, why, and the setting that brings each rule back.

Every block of output on these pages is what mutastic printed on one of the repository’s samples, kept in output/. cargo test --test docs runs each command again and fails while mutastic prints anything else, or while a page’s copy of a block differs from what’s kept; MUTASTIC_DOCS_WRITE=1 cargo test --test docs writes both again after a change to what it prints. The test the getting-started page adds is added to a copy of the sample and run. Every link between pages, every operator’s link to its section and the commands reference are checked too.