docs(skipping): warn that '&& return' breaks a conditional skip - #1214
Merged
Conversation
bashunit::skip only marks the test and execution continues, which is why it is written 'bashunit::skip "reason" && return' -- without it, one test reports both a skip and a failure. The conditional skips end in __mark_and_stop, which exits, so they need no return. Carrying the idiom across breaks them: when the condition does not hold, skip_if ends on a false 'if' and returns 0, so '&& return' fires and the test finishes having asserted nothing. It surfaces as risky rather than passing, which is the only hint. Found by writing the idiom myself while executing the guide: three tests came out risky instead of passing. The two families requiring opposite call shapes was not written down anywhere. Closes #1213
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.
🤔 Background
Related #1213
The two skip families need opposite call shapes, and nothing said so:
&& return&& returnwhen not skippingskipskip_if/skip_unless*exit 0)skip_ifends on a falseif, so it returns0,&& returnfires, and thetest finishes empty. It surfaces as risky rather than passing — the only
hint you get.
💡 Changes
docs/skipping-incomplete.mdnext to the conditional skipsFound by writing the idiom myself while executing the guide: three tests came
out risky instead of passing. The documented examples were already correct —
what was missing is why the shape differs.