test: Reject -a, -o, and parentheses in POSIXly-correct mode #161
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.
These operators were removed from the POSIX standard in 2024.
Closes #153
Summary by Copilot
This pull request introduces changes to the
test
built-in command in the Yash shell to improve POSIX compliance, deprecate certain operators, and update documentation and tests accordingly. The most significant changes include disallowing the use of-a
,-o
, and parentheses in POSIXly-correct mode, updating error messages and translations, and modifying tests to reflect the new behavior.Changes to
test
Built-in Behavior:test
([
) built-in now rejects binary operators-a
and-o
and parentheses(
,)
when the shell is in POSIXly-correct mode. Error messages are displayed when these are used in such cases. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R132-R134)
,[[2]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L306-R322)
,[[3]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L390-R408)
,[[4]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R428-R430)
,[[5]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R446-R448)
,[[6]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R473-R475)
)Documentation Updates:
doc/_test.txt
anddoc/ja/_test.txt
to reflect the deprecation of-a
,-o
, and parentheses, recommending the use of shell language constructs instead. Examples and notes were added to clarify preferred alternatives. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-1b85979c4f57e3e1a1a25f8dca191475b6f2d1e07325f462b8cf740820b56a6aR118-R141)
,[[2]](https://github.com/magicant/yash/pull/161/files#diff-1b85979c4f57e3e1a1a25f8dca191475b6f2d1e07325f462b8cf740820b56a6aL153-R175)
,[[3]](https://github.com/magicant/yash/pull/161/files#diff-8b60d1b965a3f2b41d7286413552609c9cb78734abbf154613403a2a69122737R113-R133)
,[[4]](https://github.com/magicant/yash/pull/161/files#diff-8b60d1b965a3f2b41d7286413552609c9cb78734abbf154613403a2a69122737L139-R153)
)Translation Updates:
po/ja.po
. Updated line references and timestamps for consistency. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL257-R305)
,[[2]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL1751-R1775)
,[[3]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL1792-R1838)
)Test Suite Modifications:
tests/test-p.tst
andtests/test1-y.tst
to remove tests for the now-disallowed operators in POSIXly-correct mode and add new tests to verify the correct error messages are displayed when these operators are used. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-4f468cbcaa9cdd27aabdf72899ed62810586a43e464fadfe5db72cf6278dcb81L388-L400)
,[[2]](https://github.com/magicant/yash/pull/161/files#diff-4f468cbcaa9cdd27aabdf72899ed62810586a43e464fadfe5db72cf6278dcb81L413-L430)
,[[3]](https://github.com/magicant/yash/pull/161/files#diff-710274c01e0de2d8856fe168ba7654f02985081a0eec2850b211b4d938ff4953R93-R122)
,[[4]](https://github.com/magicant/yash/pull/161/files#diff-710274c01e0de2d8856fe168ba7654f02985081a0eec2850b211b4d938ff4953R138-R192)
)Miscellaneous Updates:
builtins/test.c
to reflect the current year. ([builtins/test.cL3-R3](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L3-R3)
)These changes ensure better adherence to POSIX standards while providing clear guidance and error handling for users.