test(cargo-heather): add unit tests for missed mutations#30
Merged
Conversation
Add unit tests to catch 7 mutations that were previously missed by cargo-mutants, causing nightly CI failures since 2026-05-15. Tests added: - comment.rs: is_cargo_script inner attribute rejection, missing frontmatter, valid script detection; is_header_comment_line doc comment exclusion (/// and //!) - error.rs: HeatherError::source() returns io::Error for FileRead variant and None for others - license.rs: supported_licenses() contains known IDs and returns sorted results Fixes #27 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
=======================================
+ Coverage 87.2% 89.4% +2.1%
=======================================
Files 15 15
Lines 707 756 +49
=======================================
+ Hits 617 676 +59
+ Misses 90 80 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds targeted unit tests in cargo-heather to cover behaviors that were previously missed by mutation testing (cargo-mutants), addressing nightly CI failures reported in #27.
Changes:
- Added unit tests around cargo-script detection and header comment classification (excluding Rust doc comments).
- Added unit tests verifying
HeatherError::source()behavior forFileReadvs non-I/O variants. - Added unit tests ensuring
supported_licenses()is non-empty, contains known SPDX IDs, and returns sorted output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/cargo-heather/src/comment.rs | Adds unit tests for cargo-script heuristics and doc-comment exclusion in header detection. |
| crates/cargo-heather/src/error.rs | Adds unit tests validating Error::source() behavior across error variants. |
| crates/cargo-heather/src/license.rs | Adds unit tests validating presence of known IDs and sorted output from supported_licenses(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
martintmk
approved these changes
May 22, 2026
sandersaares
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add unit tests to catch 7 mutations that were previously missed by cargo-mutants, causing nightly CI failures since 2026-05-15.
Tests added:
Fixes #27