Repository navigation
Conversation
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>
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
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.
Summary
Adds a
verifyCodeshelper toShellCheck.Checks.Commandsthat asserts the exact sorted list of diagnostic codes a command check produces, mirroringverifyCodesTreeinShellCheck.Analyticsand this module's ownprop_verifyOptionalExamples. Uses it for thecheckCatastrophicRmtests 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
verifyand 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).prop_checkCatastrophicRmC(2115 instead of 2114) fails the suite with that prop falsified, confirming the new assertions discriminate codes; reverted before this commit.