Skip to content

Releases: sourcefrog/cargo-mutants

v23.12.2

23 Dec 08:46
v23.12.2
Compare
Choose a tag to compare

Install cargo-mutants 23.12.2

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/sourcefrog/cargo-mutants/releases/download/v23.12.2/cargo-mutants-installer.sh | sh

Install prebuilt binaries via powershell script

irm https://github.com/sourcefrog/cargo-mutants/releases/download/v23.12.2/cargo-mutants-installer.ps1 | iex

Download cargo-mutants 23.12.2

File Platform Checksum
cargo-mutants-aarch64-apple-darwin.tar.xz macOS Apple Silicon checksum
cargo-mutants-x86_64-apple-darwin.tar.xz macOS Intel checksum
cargo-mutants-x86_64-pc-windows-msvc.zip Windows x64 checksum
cargo-mutants-x86_64-unknown-linux-gnu.tar.xz Linux x64 checksum

23.12.1 tropical mutants

16 Dec 23:00
Compare
Choose a tag to compare
  • Improved progress bars and console output, including putting the outcome of each mutant on the left, and the overall progress bar at the bottom. Improved display of estimated remaining time, and other times.

  • Fixed: Correctly traverse mod statements within package top source files that are not named lib.rs or main.rs, by following the path setting of each target within the manifest.

  • Improved: Don't generate function mutants that have the same AST as the code they're replacing.

cargo-mutants 23.12.0

04 Dec 18:55
v23.12.0
Compare
Choose a tag to compare

An exciting step forward: cargo-mutants can now generate mutations smaller than a whole function. To start with, several binary operators are mutated.

Also, --in-diff will no longer error out if no mutants are generated in the diff, making it much more reasonable for a CI check.

  • New: Mutate == to != and vice versa.

  • New: Mutate && to || and vice versa, and mutate both of them to == and !=.

  • New: Mutate <, <=, >, >=.

  • Changed: If no mutants are generated then cargo mutants now exits successfully, showing a warning. (Previously it would exit with an error.) This works better with --in-diff in CI, where it's normal that some changes may not have any mutants.

  • Changed: Include column numbers in text listings of mutants and output to disambiguate smaller-than-function mutants, for example if there are several operators that can be changed on one line. This also applies to the names used for regex matching, so may break some regexps that match the entire line (sorry). The new option --line-col=false turns them both off in --list output.

  • Changed: In the mutants.json format, replaced the function, line, and return_type fields with a function submessage (including the name and return type) and a span indicating the entire replaced region, to better handle smaller-than-function mutants. Also, the function includes the line-column span of the entire function.

v23.11.2

26 Nov 19:38
v23.11.2
Compare
Choose a tag to compare
  • Changed: If --file or --exclude are set on the command line, then they replace the corresponding config file options. Similarly, if --re is given then the examine_re config key is ignored, and if --exclude-re is given then exclude_regex is ignored. (Previously the values were combined.) This makes it easier to use the command line to test files or mutants that are normally not tested.

  • Improved: By default, files matching gitignore patterns (including in parent directories, per-user configuration, and info/exclude) are excluded from copying to temporary build directories. This should improve performance in some large trees with many files that are not part of the build. This behavior can be turned off with --gitignore=false.

  • Improved: Run cargo metadata with --no-deps, so that it doesn't download and compute dependency information, which can save time in some situations.

  • Added: Alternative aliases for command line options, so you don't need to remember if it's "regex" or "re": --regex, --examine-re, --examine-regex (all for names to include) and --exclude-regex.

  • Added: Accept --manifest-path as an alternative to -d, for consistency with other cargo commands.

v23.11.1

13 Nov 01:23
v23.11.1
Compare
Choose a tag to compare
  • New --in-diff FILE option tests only mutants that are in the diff from the given file. This is useful to avoid testing mutants from code that has not changed, either locally or in CI.

v23.11.0

12 Nov 15:29
v23.11.0
Compare
Choose a tag to compare
  • Changed: cargo mutants now tries to match the behavior of cargo test when run within a workspace. If run in a package directory, it tests only that package. If run in a workspace that is not a package (a "virtual workspace"), it tests the configured default packages, or otherwise all packages. This can all be overridden with the --package or --workspace options.

  • New: generate key-value map values from types like BTreeMap<String, Vec<u8>>.

  • Changed: Send trace messages to stderr rather stdout, in part so that it won't pollute json output.

v23.10.0

04 Oct 16:54
v23.10.0
Compare
Choose a tag to compare
  • The baseline test (with no mutants) now tests only the packages in which mutants will be generated, subject to any file or regex filters. This should both make baseline tests faster, and allow testing workspaces in which some packages have non-hermetic tests.

cargo-mutants 23.9.1

17 Sep 15:02
cargo-mutants-23.9.1
Compare
Choose a tag to compare

Lots more mutation patterns!

  • Mutate the known collection types BinaryHeap, BTreeSet, HashSet, LinkedList, and VecDeque to generate empty and one-element collections using T::new() and T::from_iter(..).

  • Mutate known container types like Arc, Box, Cell, Mutex, Rc, RefCell into T::new(a).

  • Mutate unknown types that look like containers or collections T<A> or T<'a, A>' and try to construct them from an A with T::from_iter, T::new, and T::from.

  • Minimum Rust version updated to 1.70.

  • Mutate Cow<'_, T> into Owned and Borrowed variants.

  • Mutate functions returning &[T] and &mut [T] to return leaked vecs of values.

  • Mutate (A, B, C, ...) into the product of all replacements for a, b, c, ...

  • The combination of options --list --diff --json is now supported, and emits a diff key in the JSON.

  • Mutate -> impl Iterator<Item = A> to produce empty and one-element iterators of the item type.

cargo-mutants 23.9.0

17 Sep 14:42
cargo-mutants-23.9.0
Compare
Choose a tag to compare

Live from http://rustconf.com/

  • Fixed a bug causing an assertion failure when cargo-mutants was run from a subdirectory of a workspace. Thanks to @adamchalmers!
  • Generate HttpResponse::Ok().finish() as a mutation of an Actix HttpResponse.

cargo-mutants 23.6.0

11 Jun 00:15
cargo-mutants-23.6.0
Compare
Choose a tag to compare

An exciting release that adds a lot more power to generate viable mutations of functions returning more complex types.

  • Generate Box::leak(Box::new(...)) as a mutation of functions returning &mut.

  • Add a concept of mutant "genre", which is included in the json listing of mutants. The only genre today is FnValue, in which a function body is replaced by a value. This will in future allow filtering by genre.

  • Recurse into return types, so that for example Result<bool> can generate Ok(true) and Ok(false), and Some<T> generates None and every generated value of T. Similarly for Box<T>, and Vec<T>.

  • Generate specific values for integers: [0, 1] for unsigned integers, [0, 1, -1] for signed integers; [1] for NonZero unsigned integers and [1, -1] for NonZero signed integers.

  • Generate specific values for floats: [0.0, 1.0, -1.0].

  • Generate (fixed-length) array values, like [0; 256], [1; 256] using every recursively generated value for the element type.