mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
adjust tests to manually download JSON.sh
This commit is contained in:
parent
9bfc27a678
commit
e8173281a8
@ -1,7 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# this has to run once atfer git clone
|
#############################################################
|
||||||
# and every time we create new hooks
|
#
|
||||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
# File: dev/all-tests.sh
|
||||||
|
#
|
||||||
|
# Description: run all tests, exit after failed test
|
||||||
|
#
|
||||||
|
#### $$VERSION$$ v1.21-dev-10-g9bfc27a
|
||||||
|
#############################################################
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
@ -12,6 +17,7 @@ else
|
|||||||
echo "Sorry, no git repository $(pwd)" && exit 1
|
echo "Sorry, no git repository $(pwd)" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##########################
|
||||||
# create test environment
|
# create test environment
|
||||||
TESTENV="/tmp/bashbot.test$$"
|
TESTENV="/tmp/bashbot.test$$"
|
||||||
mkdir "${TESTENV}"
|
mkdir "${TESTENV}"
|
||||||
@ -21,6 +27,13 @@ cd "test" || exit 1
|
|||||||
# delete possible config
|
# delete possible config
|
||||||
rm -f "${TESTENV}/botconfig.jssh" "${TESTENV}/botacl" 2>/dev/null
|
rm -f "${TESTENV}/botconfig.jssh" "${TESTENV}/botacl" 2>/dev/null
|
||||||
|
|
||||||
|
# inject JSON.sh
|
||||||
|
mkdir "${TESTENV}/JSON.sh"
|
||||||
|
curl -sL "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" >"${TESTENV}/JSON.sh/JSON.sh"
|
||||||
|
chmod +x "${TESTENV}/JSON.sh/JSON.sh"
|
||||||
|
|
||||||
|
########################
|
||||||
|
#prepare and run tests
|
||||||
#set -e
|
#set -e
|
||||||
fail=0
|
fail=0
|
||||||
tests=0
|
tests=0
|
||||||
@ -45,6 +58,8 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# cleanup depending on test state
|
||||||
if [ "$fail" -eq 0 ]; then
|
if [ "$fail" -eq 0 ]; then
|
||||||
/bin/echo -n 'SUCCESS '
|
/bin/echo -n 'SUCCESS '
|
||||||
exitcode=0
|
exitcode=0
|
||||||
@ -56,6 +71,8 @@ else
|
|||||||
find "${TESTENV}/"* ! -name '[a-z]-*' -delete
|
find "${TESTENV}/"* ! -name '[a-z]-*' -delete
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# show test result and test logs
|
||||||
echo -e "${passed} / ${tests}\\n"
|
echo -e "${passed} / ${tests}\\n"
|
||||||
[ -d "${TESTENV}" ] && echo "Logfiles from run are in ${TESTENV}"
|
[ -d "${TESTENV}" ] && echo "Logfiles from run are in ${TESTENV}"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
#### $$VERSION$$ v1.21-dev-10-g9bfc27a
|
||||||
|
|
||||||
############
|
############
|
||||||
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
||||||
@ -68,7 +68,7 @@ fi
|
|||||||
if command -v codespell &>/dev/null; then
|
if command -v codespell &>/dev/null; then
|
||||||
echo "Running codespell"
|
echo "Running codespell"
|
||||||
echo "............................"
|
echo "............................"
|
||||||
codespell --skip="*.zip,*gz,*.log,*.html,*.txt,.git*,jsonDB-keyboard" -L "ba"
|
codespell -q 3 --skip="*.zip,*gz,*.log,*.html,*.txt,.git*,jsonDB-keyboard" -L "ba"
|
||||||
echo "if there are (to many) typo's shown, consider running:"
|
echo "if there are (to many) typo's shown, consider running:"
|
||||||
echo "codespell -i 3 -w --skip=\"*.log,*.html,*.txt,.git*,examples\" -L \"ba\""
|
echo "codespell -i 3 -w --skip=\"*.log,*.html,*.txt,.git*,examples\" -L \"ba\""
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
#### $$VERSION$$ v1.21-dev-10-g9bfc27a
|
||||||
|
|
||||||
# include common functions and definitions
|
# include common functions and definitions
|
||||||
# shellcheck source=test/ALL-tests.inc.sh
|
# shellcheck source=test/ALL-tests.inc.sh
|
||||||
@ -31,7 +31,7 @@ set +f
|
|||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cp ${TESTDIR}/*commands.sh "${BASHBOT_ETC}" || exit 1
|
cp ${TESTDIR}/*commands.sh "${BASHBOT_ETC}" || exit 1
|
||||||
set -f
|
set -f
|
||||||
cp -r "${TESTDIR}/bashbot.sh" "${TESTDIR}/modules" "${BASHBOT_BIN}" || exit 1
|
cp -r "${TESTDIR}/bashbot.sh" "${TESTDIR}/modules" "${TESTDIR}/JSON.sh/JSON.sh" "${BASHBOT_BIN}" || exit 1
|
||||||
|
|
||||||
TESTFILES="${TOKENFILE} ${ACLFILE}"
|
TESTFILES="${TOKENFILE} ${ACLFILE}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user