Added `not' expectation

Simply negates the result of whatever expectation it is given
env
Mike Gerwitz 2014-05-15 00:45:49 -04:00
parent 00cf01c27a
commit 683c4cc691
2 changed files with 18 additions and 0 deletions

View File

@ -66,3 +66,8 @@ _expect--be() { _proxy-to "$@"; }
_expect--succeed() { test "$1" -eq 0; }
_expect--fail() { test "$1" -ne 0; }
##
# Inverts the result of an expectation represented by the remainder clause
_expect--not() { ! _proxy-to "$@"; }

View File

@ -63,6 +63,19 @@ describe fail
end
describe not
it will invert the result of an expectation
# exit code of 1, so normally `succeed' would fail
expect _expect--not 1 2 succeed
to succeed
# exit code of 0, so normally `succeed' would succeed
expect _expect--not 0 2 succeed
to fail
end
end
describe output
it will default to asserting against stdout
expect _expect--output 0 2 "test string" <<< "test string"