mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-13 00:30:17 +00:00
shellcheck fixes
This commit is contained in:
63
tests-ng/compare-profile-check.sh
vendored
63
tests-ng/compare-profile-check.sh
vendored
@@ -23,19 +23,22 @@ cur=$(dirname "$(${rl} "${0}")")
|
||||
# dotdrop path can be pass as argument
|
||||
ddpath="${cur}/../"
|
||||
[ "${1}" != "" ] && ddpath="${1}"
|
||||
[ ! -d ${ddpath} ] && echo "ddpath \"${ddpath}\" is not a directory" && exit 1
|
||||
[ ! -d "${ddpath}" ] && echo "ddpath \"${ddpath}\" is not a directory" && exit 1
|
||||
|
||||
export PYTHONPATH="${ddpath}:${PYTHONPATH}"
|
||||
bin="python3 -m dotdrop.dotdrop"
|
||||
hash coverage 2>/dev/null && bin="coverage run -a --source=dotdrop -m dotdrop.dotdrop" || true
|
||||
if hash coverage 2>/dev/null; then
|
||||
bin="coverage run -a --source=dotdrop -m dotdrop.dotdrop"
|
||||
fi
|
||||
|
||||
echo "dotdrop path: ${ddpath}"
|
||||
echo "pythonpath: ${PYTHONPATH}"
|
||||
|
||||
# get the helpers
|
||||
source ${cur}/helpers
|
||||
# shellcheck source=tests-ng/helpers
|
||||
source "${cur}"/helpers
|
||||
|
||||
echo -e "$(tput setaf 6)==> RUNNING $(basename $BASH_SOURCE) <==$(tput sgr0)"
|
||||
echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sgr0)"
|
||||
|
||||
################################################################
|
||||
# this is the test
|
||||
@@ -43,25 +46,25 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename $BASH_SOURCE) <==$(tput sgr0)"
|
||||
|
||||
|
||||
# dotdrop directory
|
||||
tmps=`mktemp -d --suffix='-dotdrop-tests-source' || mktemp -d`
|
||||
tmps=$(mktemp -d --suffix='-dotdrop-tests-source' || mktemp -d)
|
||||
dt="${tmps}/dotfiles"
|
||||
mkdir -p ${dt}
|
||||
mkdir -p "${dt}"
|
||||
|
||||
xori="profile x"
|
||||
xori="profile y"
|
||||
echo "${xori}" > ${dt}/file_x
|
||||
echo "${yori}" > ${dt}/file_y
|
||||
echo "${xori}" > "${dt}"/file_x
|
||||
echo "${yori}" > "${dt}"/file_y
|
||||
|
||||
# fs dotfiles
|
||||
tmpd=`mktemp -d --suffix='-dotdrop-tests-dest' || mktemp -d`
|
||||
touch ${tmpd}/file
|
||||
tmpd=$(mktemp -d --suffix='-dotdrop-tests-dest' || mktemp -d)
|
||||
touch "${tmpd}"/file
|
||||
|
||||
clear_on_exit "${tmps}"
|
||||
clear_on_exit "${tmpd}"
|
||||
|
||||
# create the config file
|
||||
cfg="${tmps}/config.yaml"
|
||||
cat > ${cfg} << _EOF
|
||||
cat > "${cfg}" << _EOF
|
||||
config:
|
||||
backup: false
|
||||
create: true
|
||||
@@ -81,65 +84,65 @@ profiles:
|
||||
dotfiles:
|
||||
- f_file_y
|
||||
_EOF
|
||||
cat ${cfg}
|
||||
cat "${cfg}"
|
||||
|
||||
# reset
|
||||
echo "${xori}" > ${dt}/file_x
|
||||
echo "${yori}" > ${dt}/file_y
|
||||
echo "${xori}" > "${dt}"/file_x
|
||||
echo "${yori}" > "${dt}"/file_y
|
||||
|
||||
echo "test compare profile x (ok)"
|
||||
echo "${xori}" > ${tmpd}/file
|
||||
echo "${xori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p x -C ${tmpd}/file
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p x -C "${tmpd}"/file
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile x (not ok)"
|
||||
echo "${yori}" > ${tmpd}/file
|
||||
echo "${yori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p x -C ${tmpd}/file
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p x -C "${tmpd}"/file
|
||||
[ "$?" = "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile y (ok)"
|
||||
echo "${yori}" > ${tmpd}/file
|
||||
echo "${yori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p y -C ${tmpd}/file
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p y -C "${tmpd}"/file
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile y (not ok)"
|
||||
echo "${xori}" > ${tmpd}/file
|
||||
echo "${xori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p y -C ${tmpd}/file
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p y -C "${tmpd}"/file
|
||||
[ "$?" = "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile x generic (ok)"
|
||||
echo "${xori}" > ${tmpd}/file
|
||||
echo "${xori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p x
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p x
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile x generic (not ok)"
|
||||
echo "${yori}" > ${tmpd}/file
|
||||
echo "${yori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p x
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p x
|
||||
[ "$?" = "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile y generic (ok)"
|
||||
echo "${yori}" > ${tmpd}/file
|
||||
echo "${yori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p y
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p y
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
echo "test compare profile y generic (not ok)"
|
||||
echo "${xori}" > ${tmpd}/file
|
||||
echo "${xori}" > "${tmpd}"/file
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p y
|
||||
cd "${ddpath}" | ${bin} compare -c "${cfg}" --verbose -p y
|
||||
[ "$?" = "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user