]> git.ipfire.org Git - thirdparty/coreutils.git/commit
test: simplify redundant code
authorBernhard Voelker <mail@bernhard-voelker.de>
Sun, 21 Oct 2018 19:56:43 +0000 (21:56 +0200)
committerBernhard Voelker <mail@bernhard-voelker.de>
Fri, 26 Oct 2018 08:54:11 +0000 (10:54 +0200)
commit7fd7709a7a5f3537f2f373dcc57e17001830591e
tree72512cd42ebb7bc8a1e2a28a725b679587c5e78a
parent88c32fa68ee7057744bfb6d41f6e8eb68801306f
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.
src/test.c
tests/misc/test-diag.pl