diff --git a/test/a-commit-test.sh b/test/a-commit-test.sh index ef8f1d9..1a451c9 100755 --- a/test/a-commit-test.sh +++ b/test/a-commit-test.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.20-0-g2ab00a2 +#=============================================================================== +# +# FILE: b-example-test.sh +# +# USAGE: must run only from dev/all-tests.sh +# +# DESCRIPTION: run pre-commit tests first +# +# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ +# AUTHOR: KayM (gnadelwartz), kay@rrr.de +# +#### $$VERSION$$ v1.21-pre-35-g32b99dc +#=============================================================================== ../dev/hooks/pre-commit.sh diff --git a/test/b-example-test.sh b/test/b-example-test.sh index 9429f88..533a30b 100644 --- a/test/b-example-test.sh +++ b/test/b-example-test.sh @@ -10,7 +10,7 @@ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # -#### $$VERSION$$ v1.21-pre-34-g9492f98 +#### $$VERSION$$ v1.21-pre-35-g32b99dc #=============================================================================== # include common functions and definitions @@ -23,7 +23,7 @@ source "./ALL-tests.inc.sh" # example: test if TESTDIR contains file bashbot.sh printf "Check if bashbot.sh exists in %s ...\n" " ${TESTDIR}" if [ -f "${TESTDIR}/bashbot.sh" ]; then - printf "bashbot.sh found!\n" + printf " ... bashbot.sh found!\n" else # stop test script if test failed printf "%s\n" "${NOSUCCESS} ${TESTDIR}/bashbot.sh missing!" diff --git a/test/c-init-test.sh b/test/c-init-test.sh index 4490d80..25f26c9 100755 --- a/test/c-init-test.sh +++ b/test/c-init-test.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.21-pre-18-g05b81ff +#=============================================================================== +# +# FILE: c-init-test.sh +# +# USAGE: must run only from dev/all-tests.sh +# +# DESCRIPTION: test "bashbot.sh init" and sourcing bashbot.sh +# +# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ +# AUTHOR: KayM (gnadelwartz), kay@rrr.de +# +#### $$VERSION$$ v1.21-pre-35-g32b99dc +#=============================================================================== # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh @@ -10,38 +22,41 @@ TESTFILES="${TOKENFILE} ${ACLFILE} ${COUNTFILE} ${BLOCKEDFILE} ${ADMINFILE}" #set -e # run bashbot first time with init +printf "Run bashbot init ...\n" "${TESTDIR}/bashbot.sh" init >"${LOGFILE}" <>"${LOGFILE}" - diff -q "${TESTDIR}/${file}" "${REFDIR}/${file}" >>"${LOGFILE}" || { echo "${NOSUCCESS} Fail diff ${file}!"; FAIL="1"; } + diff -q "${TESTDIR}/${file}" "${REFDIR}/${file}" >>"${LOGFILE}" || { printf "%s\n" "${NOSUCCESS} Fail diff ${file}!"; FAIL="1"; } done [ "${FAIL}" != "0" ] && exit "${FAIL}" -echo "${SUCCESS}" +printf "%s\n" "${SUCCESS}" trap exit 1 EXIT cd "${TESTDIR}" || exit -echo "Test if $JSONSHFILE exists ..." -[ ! -x "$JSONSHFILE" ] && { echo "${NOSUCCESS} json.sh not found"; exit 1; } +printf "%s\n" "Test if ${JSONSHFILE} exists ..." +[ ! -x "$JSONSHFILE" ] && { printf "%s\n" "${NOSUCCESS} json.sh not found"; exit 1; } -echo "Test Sourcing of bashbot.sh ..." +printf "Test Sourcing of bashbot.sh ..." # shellcheck source=./bashbot.sh source "${TESTDIR}/bashbot.sh" source -echo "Test Sourcing of commands.sh ..." + +printf "Test Sourcing of commands.sh ...\n" source "${TESTDIR}/commands.sh" source trap '' EXIT cd "${DIRME}" || exit 1 -echo "${SUCCESS}" + +printf "%s\n" "${SUCCESS}"