Skip to content

Test catastrophicRm assertions against expected diagnostic codes - #3617

Open
hakarrr wants to merge 1 commit into
koalaman:masterfrom
hakarrr:verifycodes-command-tests-3603
Open

hakarrr wants to merge 1 commit into
koalaman:masterfrom
hakarrr:verifycodes-command-tests-3603

Conversation

@hakarrr

@hakarrr hakarrr commented Nov 12, 2026

Copy link
Copy Markdown

Summary

Adds a verifyCodes helper to ShellCheck.Checks.Commands that asserts the exact sorted list of diagnostic codes a command check produces, mirroring verifyCodesTree in ShellCheck.Analytics and this module's own prop_verifyOptionalExamples. Uses it for the checkCatastrophicRm tests so SC2114 and SC2115 are distinguished instead of just "any warning".

This is an initial conversion of the checkCatastrophicRm family from #3603; other command checks still use the any-warning verify and can be converted separately.

Refs #3603

Testing

  • cabal test test-shellcheck: full suite passes, 2438 property results OK, 0 failures (GHC 9.6.6, built at -O0 in my environment).
  • Negative control: temporarily expecting the wrong code in prop_checkCatastrophicRmC (2115 instead of 2114) fails the suite with that prop falsified, confirming the new assertions discriminate codes; reverted before this commit.

Unit tests for command checks only verified that a warning was
produced, not which one. Add a verifyCodes helper that asserts the
exact sorted list of diagnostic codes, and use it for the
checkCatastrophicRm tests so SC2114 and SC2115 are distinguished.

Refs koalaman#3603

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
@hakarrr

hakarrr commented Nov 13, 2026

Copy link
Copy Markdown
Author

Could a maintainer review this catastrophicRm test change to check expected diagnostic codes? Please let me know if the assertions need changing or if anything else is needed before it can move forward. Thanks.

This branch has not been deployed

No deployments
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.

1 participant