Goal
Make array-kind validation independent of the caller's nocasematch shell option.
Background
PR #521 (fix: validate caller-owned output attributes) added caller-owned output
contracts and a regression test that enables shopt -s nocasematch. The hosted
validation run for that PR fails on both Ubuntu and macOS in the same test:
array output contracts distinguish indexed from associative arrays with nocasematch
The validator currently classifies the kind marker with a [[ ... == ... ]]
comparison. With nocasematch enabled, the lower-case indexed marker a matches
the upper-case associative marker A, so the validator emits the wrong diagnostic
instead of the indexed-array kind diagnostic. The existing string-split regression
test also asserts the later output-attribute diagnostic for an associative array;
that expectation needs to be corrected because the kind contract is the first
applicable contract and must reject the wrong array kind before checking writability.
Scope and acceptance criteria
- Make the array-kind classification case-sensitive even when
nocasematch is
enabled by the caller.
- Preserve the existing Bash 4.2-compatible implementation style and the public
single-file library boundary.
- Add a focused regression test that exercises the validator under
nocasematch
and verifies the indexed/associative distinction; update the string-split
regression assertion to expect the correct indexed-array diagnostic.
- Keep existing diagnostics, return codes, and caller-owned output preservation
unchanged outside this defect.
bats focused regression tests pass, and ./tests/validate.sh passes.
Validation
The implementation PR will record the exact focused BATS command and full
validation result.
Non-goals
- No redesign of the output-contract API.
- No compatibility shim for pre-v2 behavior.
- No unrelated refactoring or release/version changes.
Related: #521
Goal
Make array-kind validation independent of the caller's
nocasematchshell option.Background
PR #521 (
fix: validate caller-owned output attributes) added caller-owned outputcontracts and a regression test that enables
shopt -s nocasematch. The hostedvalidation run for that PR fails on both Ubuntu and macOS in the same test:
array output contracts distinguish indexed from associative arrays with nocasematchThe validator currently classifies the kind marker with a
[[ ... == ... ]]comparison. With
nocasematchenabled, the lower-case indexed markeramatchesthe upper-case associative marker
A, so the validator emits the wrong diagnosticinstead of the indexed-array kind diagnostic. The existing string-split regression
test also asserts the later output-attribute diagnostic for an associative array;
that expectation needs to be corrected because the kind contract is the first
applicable contract and must reject the wrong array kind before checking writability.
Scope and acceptance criteria
nocasematchisenabled by the caller.
single-file library boundary.
nocasematchand verifies the indexed/associative distinction; update the string-split
regression assertion to expect the correct indexed-array diagnostic.
unchanged outside this defect.
batsfocused regression tests pass, and./tests/validate.shpasses.Validation
The implementation PR will record the exact focused BATS command and full
validation result.
Non-goals
Related: #521