Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/tests/bin/sh



Module Name:    src
Committed By:   kre
Date:           Tue Nov 24 13:58:11 UTC 2026

Modified Files:
        src/tests/bin/sh: t_expand.sh

Log Message:
tests/bin/sh/t_expand ... add test cases for ${@-word} (etc)

This usage (using the + - (also ? =) modifiers in parameter
expansions when the special parameter '@' (or '*') is being
expanded, is expressly left unspecified in the standard, and
applications should not attempt it - as different shells
produce different results.

Hence these new test case only run their sub-tests when the
shell being tested is the NetBSD shell - and are to verify
that that shell continues to produce sane (in our opinion)
results from these unspecified expansions, even if that might,
in some (or many) cases differ from what other shells do.

There are something around 350 new sub tests added (initially)
across the 4 new test cases -- those being to test the 4
major variations:  "${@:-word}" "${@-word}" ${@:-word} ${@-word}
Each test case tests both the - and + operator.   Note that it
is whether the $@ is quoted or not that matters, not whether
the 'word' happens to be in the final 2 versions, where that
might vary (it shouldn't in the quoted cases, that would be even
more unspecified, so there it always should be).

With a version of sh fixed as it is planned to be, about the
same time these tests are committed, all added test cases should
pass - with a sh from just a day (or anything earlier) previously,
that will not be the case.   Note that all the expected output
for the new tests was created by hand, by determining what the
output should be, and entering that - not just by running all
the tests through sh and including whatever it happened to output.

No pullups planned.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/bin/sh/t_expand.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index