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
This commit is contained in:
Robert Fairley authored and Atomic Bot committed 2018-07-05 17:59:09 +00:00
1 parent 3696e1cfdd
commit 4f096c8f11
2 files changed
+9 -9

No files matched your search

+9
View File
@@ -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
}
-9
View File
@@ -33,15 +33,6 @@ setup_fake_remote_repo1 "archive" "" \
--expected-header baz=badger \
--expected-header "User-Agent=libostree/$V dodo/2.15"
assert_fail (){
set +e
$@
if [ $? = 0 ] ; then
echo 1>&2 "$@ did not fail"; exit 1
fi
set -euo pipefail
}
cd ${test_tmpdir}
rm repo -rf
mkdir repo