fix(cli): reject a standalone assertion with no arguments#878
Merged
Conversation
exec_assert computed last_index as args_count - 1 without checking the count. With no arguments that is -1, and Bash 3.x has no negative array subscripts, so the expansion failed with a raw 'bad array subscript' and the run still exited 0: $ ./bashunit assert equals ./src/main.sh: line 1131: args: bad array subscript $ echo $? 0 docs/standalone.md presents this subcommand for integration checks, so a mistyped invocation in a deploy script reported success. It now errors naming the assertion and exits non-zero. Closes #877
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 #877
exec_assertcomputedlast_indexasargs_count - 1without checking the count.With no arguments that is
-1, and Bash 3.x has no negative array subscripts, so theexpansion failed with a raw
bad array subscript— and the run still exited0.docs/standalone.mdpresents this subcommand for integration and end-to-end checks, soa mistyped invocation in a deploy script reported success.
💡 Changes
.claude/rules/bash-style.mdassert empty "") still succeeds