Skip to content

Commit

Permalink
add example to run one mutant
Browse files Browse the repository at this point in the history
  • Loading branch information
ASuciuX committed Aug 8, 2024
1 parent 9d137db commit f129669
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/mutation-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ cargo install --version 24.7.1 cargo-mutants --locked
--test-tool=nextest \
-- --all-targets --test-threads 1
```

## How to run one specific mutant to test it

Example of output which had a missing mutant
```sh
MISSED stacks-signer/src/runloop.rs:424:9: replace <impl SignerRunLoop for RunLoop<Signer, T>>::run_one_pass -> Option<Vec<SignerResult>> with None in 3.0s build + 9.3s test
```
Example of fix for it
```sh
RUST_BACKTRACE=1 BITCOIND_TEST=1 cargo mutants -vV -F "replace process_stackerdb_event" -E ": replace <impl SignerRunLoop for RunLoop<Signer, T>>::run_one_pass -> Option<Vec<SignerResult>> with None in " --test-tool=nextest -- --run-ignored all --fail-fast --test-threads 1
```
General command to run
```sh
RUST_BACKTRACE=1 BITCOIND_TEST=1 cargo mutants -vV -F "replace process_stackerdb_event" -E ": replace [modify this] with [modify this] in " --test-tool=nextest -- --run-ignored all --fail-fast --test-threads 1
```

2 comments on commit f129669

@wileyj
Copy link
Contributor

@wileyj wileyj commented on f129669 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adjust the code blocks with line breaks for readability?
i.e.
Example of fix for it

RUST_BACKTRACE=1 BITCOIND_TEST=1 \
cargo mutants -vV \
  -F "replace process_stackerdb_event" \
  -E ": replace <impl SignerRunLoop for RunLoop<Signer, T>>::run_one_pass -> Option<Vec<SignerResult>> with None in " \
  --test-tool=nextest \
  -- \
  --run-ignored all \
  --fail-fast \
  --test-threads 1

@ASuciuX
Copy link
Contributor Author

@ASuciuX ASuciuX commented on f129669 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust the code blocks with line breaks for readability

Done

Please sign in to comment.