Improve output of tests/args.sh when failing

This commit is contained in:
Geod24 2020-08-20 12:41:57 +09:00 committed by Mathias LANG
parent 1d648ce5ae
commit 13c61544fe

View file

@ -3,8 +3,8 @@
set -e set -e
die() { echo "$@" 1>&2 ; exit 1; } die() { echo "$@" 1>&2 ; exit 1; }
( dub args.d | grep -q '^argtest=$' ) || die "Fail (no argument)" ( dub args.d | grep -q '^argtest=$' ) || die "Fail (no argument): '`dub args.d`'"
( dub args.d --argtest=aoeu | grep -q '^argtest=aoeu$' ) || die "Fail (with argument)" ( dub args.d --argtest=aoeu | grep -q '^argtest=aoeu$' ) || die "Fail (with argument): '`dub args.d --argtest=aoeu`'"
( ( ! dub args.d --inexisting 2>&1 ) | grep -qF 'Unrecognized command line option' ) || die "Fail (unknown argument)" ( ( ! dub args.d --inexisting 2>&1 ) | grep -qF 'Unrecognized command line option' ) || die "Fail (unknown argument): '`dub args.d --inexisting 2>&1`'"
echo 'OK' echo 'OK'