mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 00:43:07 +02:00
Actually run shell tests (#3583)
Two of these used EXPFAIL which, because nothing is interpreting the TAP output, does not work. So, that functionality is removed, and the expected-to-fail bits are commented out or removed. There was a conditional on the filename in `bash_tap.sh` which caused it to not actually do anything and just run the test as a simple shell script. That, too, has been removed.
This commit is contained in:
parent
c0b708d1f3
commit
17889a3f25
5 changed files with 69 additions and 54 deletions
|
@ -8,13 +8,7 @@ function bashtap_on_error {
|
|||
# $bashtap_line contains the last executed line, or an error.
|
||||
echo -n "$bashtap_output"
|
||||
|
||||
# Determine if this failure was expected
|
||||
if [[ ! -z "$EXPFAIL" ]]
|
||||
then
|
||||
todo_suffix=" # TODO"
|
||||
fi
|
||||
|
||||
echo "not ok 1 - ${bashtap_line}${todo_suffix}"
|
||||
echo "not ok 1 - ${bashtap_line}"
|
||||
bashtap_clean_tmpdir
|
||||
}
|
||||
|
||||
|
@ -81,41 +75,35 @@ function bashtap_get_absolute_path {
|
|||
bashtap_org_pwd=$(pwd)
|
||||
bashtap_org_script=$(bashtap_get_absolute_path "$0")
|
||||
|
||||
if [ "${0:(-2)}" == ".t" ] || [ "$1" == "-t" ]; then
|
||||
# Make sure any failing commands are caught.
|
||||
set -e
|
||||
set -o pipefail
|
||||
# Make sure any failing commands are caught.
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# TAP header. Hardcoded number of tests, 1.
|
||||
echo "1..1"
|
||||
# TAP header. Hardcoded number of tests, 1.
|
||||
echo "1..1"
|
||||
|
||||
# Output TAP failure on early exit.
|
||||
trap bashtap_on_error EXIT
|
||||
# Output TAP failure on early exit.
|
||||
trap bashtap_on_error EXIT
|
||||
|
||||
# The different calls to mktemp are necessary for OSX compatibility.
|
||||
bashtap_tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'bash_tap')
|
||||
if [ ! -z "$bashtap_tmpdir" ]; then
|
||||
cd "$bashtap_tmpdir"
|
||||
else
|
||||
bashtap_line="Unable to create temporary directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Scripts sourced before bash_tap.sh may declare this function.
|
||||
if declare -f bashtap_setup >/dev/null; then
|
||||
bashtap_setup
|
||||
fi
|
||||
|
||||
# Run test file interpreting failing commands as a test failure.
|
||||
bashtap_run_testcase && echo "ok 1"
|
||||
|
||||
# Since we're in a sourced file and just ran the parent script,
|
||||
# exit without running it a second time.
|
||||
trap - EXIT
|
||||
bashtap_clean_tmpdir
|
||||
exit
|
||||
# The different calls to mktemp are necessary for OSX compatibility.
|
||||
bashtap_tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'bash_tap')
|
||||
if [ ! -z "$bashtap_tmpdir" ]; then
|
||||
cd "$bashtap_tmpdir"
|
||||
else
|
||||
if declare -f bashtap_setup >/dev/null; then
|
||||
bashtap_setup
|
||||
fi
|
||||
bashtap_line="Unable to create temporary directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Scripts sourced before bash_tap.sh may declare this function.
|
||||
if declare -f bashtap_setup >/dev/null; then
|
||||
bashtap_setup
|
||||
fi
|
||||
|
||||
# Run test file interpreting failing commands as a test failure.
|
||||
bashtap_run_testcase && echo "ok 1"
|
||||
|
||||
# Since we're in a sourced file and just ran the parent script,
|
||||
# exit without running it a second time.
|
||||
trap - EXIT
|
||||
bashtap_clean_tmpdir
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue