Added _bail_clause shorthand

There will be a test for bailing on output's clause shortly, now that we can
assert on output...testing itself.
stderr
Mike Gerwitz 2014-05-09 02:14:34 -04:00
parent 08e1d9c889
commit ca527165aa
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
1 changed files with 12 additions and 1 deletions

View File

@ -23,6 +23,17 @@
__INC_EXPECT_CORE=1
##
# Shorthand for bailing out on unrecognized clauses
_bail_clause()
{
local -r type="$1"
local -r clause="$2"
_bail "unrecognized \`$type' clause: \`$2'"
}
_expect--succeed() { test "$1" -eq 0; }
_expect--fail() { test "$1" -ne 0; }
@ -36,7 +47,7 @@ _expect--output()
if [ -n "$clause" ]; then
[ "$clause" == 'without newline' ] \
&& nl=-n \
|| _bail "unrecognized output clause: $clause"
|| _bail_clause output "$clause"
fi
# we will eventually be interested in this output