Skip to content

test(cargo-heather): add unit tests for missed mutations#30

Merged
Vaiz merged 1 commit into
mainfrom
u/vaiz/fix-missed-mutations
May 25, 2026
Merged

test(cargo-heather): add unit tests for missed mutations#30
Vaiz merged 1 commit into
mainfrom
u/vaiz/fix-missed-mutations

Conversation

@Vaiz
Copy link
Copy Markdown
Contributor

@Vaiz Vaiz commented May 22, 2026

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

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>
Copilot AI review requested due to automatic review settings May 22, 2026 14:11
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.4%. Comparing base (b056994) to head (afe2512).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 for FileRead vs 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.

@Vaiz Vaiz enabled auto-merge (squash) May 22, 2026 14:36
@Vaiz Vaiz merged commit 93c6346 into main May 25, 2026
26 checks passed
@Vaiz Vaiz deleted the u/vaiz/fix-missed-mutations branch May 25, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚨 Nightly Build Failed: 2026-05-15

5 participants