diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2018-10-21 21:56:43 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2018-10-26 10:54:11 +0200 |
commit | 7fd7709a7a5f3537f2f373dcc57e17001830591e (patch) | |
tree | 72512cd42ebb7bc8a1e2a28a725b679587c5e78a /tests/misc/test-diag.pl | |
parent | 88c32fa68ee7057744bfb6d41f6e8eb68801306f (diff) | |
download | coreutils-7fd7709a7a5f3537f2f373dcc57e17001830591e.tar.gz |
test: simplify redundant code
Remove the function 'test_unop', as the cases therein are redundant to
those handled by 'unary_operator'; exception: the cases 'o' and 'N':
they had been present in test_unop and handling the commands
test -N STR
test -o STR
and
test x = x -a -N STR
test x = x -a -o STR
which ran into an error later on anyway.
With this commit, the error diagnostic will change from ...
$ /usr/bin/test -N STR
/usr/bin/test: extra argument '-N'
$ /usr/bin/test -o STR
/usr/bin/test: extra argument '-o'
... to ...
$ src/test -N STR
src/test: '-N': unary operator expected
$ src/test -o STR
src/test: '-o': unary operator expected
* src/test.c (test_unop): Remove.
(unary_operator): Fail with test_syntax_error in the default case.
(term): Directly call unary_operator.
(two_arguments): Likewise.
* tests/misc/test-diag.pl: Adjust error diagnostic.
Diffstat (limited to 'tests/misc/test-diag.pl')
-rwxr-xr-x | tests/misc/test-diag.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/misc/test-diag.pl b/tests/misc/test-diag.pl index 91356ef56..f543f9f09 100755 --- a/tests/misc/test-diag.pl +++ b/tests/misc/test-diag.pl @@ -26,8 +26,8 @@ use strict; my @Tests = ( # In coreutils-5.93, this diagnostic lacked the newline. - ['o', '-o arg', {ERR => "test: extra argument '-o'\n"}, - {ERR_SUBST => 's!^.*:!test:!'}, + ['o', '-o arg', {ERR => "test: '-o': unary operator expected\n"}, + {ERR_SUBST => 's!^.*test:!test:!'}, {EXIT => 2}], ); |