summaryrefslogtreecommitdiff
path: root/tests/libtest.sh
diff options
context:
space:
mode:
authorRobert Fairley <rfairley@redhat.com>2018-07-05 12:30:05 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-05 17:59:09 +0000
commit4f096c8f11c06883c5eec03c0ad6d962f3d82a4d (patch)
tree539c8fa075b45cb30522f5438bdf26b56a2953e2 /tests/libtest.sh
parent3696e1cfdd1f0109c7cd9e157763ecef23ae7adc (diff)
downloadostree-4f096c8f11c06883c5eec03c0ad6d962f3d82a4d.tar.gz
tests: Move assert_fail function to tests/libtest.sh
This moves the assert_fail function definition which was defined and called in tests/test-remote-headers.sh. Done in preparation for use of the assert_fail function in other test files. Closes: #1669 Approved by: jlebon
Diffstat (limited to 'tests/libtest.sh')
-rwxr-xr-xtests/libtest.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 388408df..f09f4a2c 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -648,3 +648,12 @@ assert_not_ref () {
fatal "rev-parse $2 unexpectedly succeeded!"
fi
}
+
+assert_fail () {
+ set +e
+ $@
+ if [ $? = 0 ] ; then
+ echo 1>&2 "$@ did not fail"; exit 1
+ fi
+ set -euo pipefail
+}