test/: fix missing ${xxx}

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-05 12:06:22 +01:00
parent 248a065be4
commit 14fa2c7635
4 changed files with 16 additions and 16 deletions

View File

@ -11,7 +11,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-8-g248a065
#=============================================================================== #===============================================================================
# common variables # common variables
@ -61,9 +61,9 @@ print_array() {
local idx t local idx t
local arrays=( "${@}" ) local arrays=( "${@}" )
for idx in "${arrays[@]}"; do for idx in "${arrays[@]}"; do
declare -n temp="$idx" declare -n temp="${idx}"
for t in "${!temp[@]}"; do for t in "${!temp[@]}"; do
printf '%s:\t%s\t%s\n' "$idx" "$t" "${temp[$t]}" printf '%s:\t%s\t%s\n' "${idx}" "${t}" "${temp[${t}]}"
done | sort done | sort
done | grep -v '^USER: 0' done | grep -v '^USER: 0'
} }
@ -76,7 +76,7 @@ compare_sorted() {
diff -c "${1}.sort" "${2}.sort" || ret=1 diff -c "${1}.sort" "${2}.sort" || ret=1
[[ "${1}" != "${TESTDIR}"* ]] && rm -f "${1}.sort" [[ "${1}" != "${TESTDIR}"* ]] && rm -f "${1}.sort"
[[ "${2}" != "${TESTDIR}"* ]] && rm -f "${2}.sort" [[ "${2}" != "${TESTDIR}"* ]] && rm -f "${2}.sort"
return "$ret" return "${ret}"
} }
###### ######

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-8-g248a065
#=============================================================================== #===============================================================================
# include common functions and definitions # include common functions and definitions
@ -24,7 +24,7 @@ TESTFILES="${TOKENFILE} ${ACLFILE} ${COUNTFILE} ${BLOCKEDFILE} ${ADMINFILE}"
# run bashbot first time with init # run bashbot first time with init
printf "Run bashbot init ...\n" printf "Run bashbot init ...\n"
"${TESTDIR}/bashbot.sh" init >"${LOGFILE}" <<EOF "${TESTDIR}/bashbot.sh" init >"${LOGFILE}" <<EOF
$TESTTOKEN ${TESTTOKEN}
nobody nobody
botadmin botadmin
@ -46,7 +46,7 @@ trap exit 1 EXIT
cd "${TESTDIR}" || exit cd "${TESTDIR}" || exit
printf "%s\n" "Test if ${JSONSHFILE} exists ..." printf "%s\n" "Test if ${JSONSHFILE} exists ..."
[ ! -x "$JSONSHFILE" ] && { printf "%s\n" "${NOSUCCESS} json.sh not found"; exit 1; } [ ! -x "${JSONSHFILE}" ] && { printf "%s\n" "${NOSUCCESS} json.sh not found"; exit 1; }
printf "Test Sourcing of bashbot.sh ...\n" printf "Test Sourcing of bashbot.sh ...\n"
# shellcheck source=./bashbot.sh # shellcheck source=./bashbot.sh

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-8-g248a065
#=============================================================================== #===============================================================================
# include common functions and definitions # include common functions and definitions
@ -51,18 +51,18 @@ printf " Send line ..."
# create dummy files for upload # create dummy files for upload
ALLOW='/tmp/allowed' ALLOW='/tmp/allowed'
FILE_REGEX="$ALLOW/.*" FILE_REGEX="${ALLOW}/.*"
[ -d "$ALLOW" ] || mkdir "$ALLOW" [ -d "${ALLOW}" ] || mkdir "${ALLOW}"
touch "$ALLOW/this_is_my.gif" "$ALLOW/this_is_my.doc" touch "${ALLOW}/this_is_my.gif" "${ALLOW}/this_is_my.doc"
touch "$DATADIR/this_is_my.gif" "$DATADIR/this_is_my.doc" touch "${DATADIR}/this_is_my.gif" "${DATADIR}/this_is_my.doc"
while read -r line ; do while read -r line ; do
set -x; set +e set -x; set +e
send_message "123456" "$line" >>"${OUTPUTFILE}" send_message "123456" "${line}" >>"${OUTPUTFILE}"
set +x; set -e set +x; set -e
printf "." printf "."
done < "${INPUTFILE}" 2>>"${LOGFILE}" done < "${INPUTFILE}" 2>>"${LOGFILE}"
[ -d "$ALLOW" ] && rm -rf "$ALLOW" [ -d "${ALLOW}" ] && rm -rf "${ALLOW}"
printf " done.\n" printf " done.\n"

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-8-g248a065
#=============================================================================== #===============================================================================
# include common functions and definitions # include common functions and definitions
@ -53,7 +53,7 @@ mkdir "${BASHBOT_VAR}/${DATADIR}"
# run bashbot first time with init # run bashbot first time with init
"${BASHBOT_BIN}/bashbot.sh" init >"${LOGFILE}" <<EOF "${BASHBOT_BIN}/bashbot.sh" init >"${LOGFILE}" <<EOF
$TESTTOKEN ${TESTTOKEN}
nobody nobody
botadmin botadmin
EOF EOF