CVS commit: src/tests/bin/sh

"Robert Elz" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	kre
Date:		Wed Jul  1 10:45:59 UTC 2026

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

Log Message:
sh tests: arithmetic: fix test for support of pre ++/-- ops

The C prefix and postfix unary ++ and -- operators are optional
in POSIX sh (supported in NetBSD's sh).   To allow these tests to be
used to test other shells, the tests generally attempt to verify that
optional features are supported, before testing them.

The prefix ++ and -- tests, to see if there was support in ${TEST_SH}
were not guaranteed to work, as ++X might be preincrement X, or it
might just be + + X (ie: applying the unary + operator twice).

Fix that by testing whether ++X and + + X give the same result, if
they do, then prefix ++ is not supported (also if ++X generates an error)

Just the same for the prefix -- operator.

The postfix operator tests are OK, X-- is either X-- or an error.

NFCI for tests of the NetBSD sh.   (This change has been in my local
set of sh tests for a long time now.)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/bin/sh/t_arith.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.