diff --git a/tests-ng/dir-import-update.sh b/tests-ng/dir-import-update.sh index c35f7de..c81fdc8 100755 --- a/tests-ng/dir-import-update.sh +++ b/tests-ng/dir-import-update.sh @@ -51,7 +51,6 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sg # dotdrop directory basedir=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) -dotfiles="${basedir}/dotfiles" echo "dotdrop dir: ${basedir}" # the dotfile tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) diff --git a/tests-ng/import-link-children.sh b/tests-ng/import-link-children.sh index 7332333..5158462 100755 --- a/tests-ng/import-link-children.sh +++ b/tests-ng/import-link-children.sh @@ -28,7 +28,7 @@ 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" @@ -40,48 +40,49 @@ 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[0]}) <==$(tput sgr0)" +echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sgr0)" ################################################################ # this is the test ################################################################ # the dotfile source -tmps=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d` -mkdir -p ${tmps}/dotfiles +tmps=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) +mkdir -p "${tmps}"/dotfiles # the dotfile destination -tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d` +tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) clear_on_exit "${tmps}" clear_on_exit "${tmpd}" # dotpath dotpath="${tmps}/dotfiles" -mkdir -p ${dotpath} +mkdir -p "${dotpath}" # create the dotfile to import dt="${tmpd}/directory" -mkdir -p ${dt} +mkdir -p "${dt}" # subdir dtsub1="${dt}/sub1" -mkdir -p ${dtsub1} +mkdir -p "${dtsub1}" dtsub2="${dt}/sub2" -mkdir -p ${dtsub2} +mkdir -p "${dtsub2}" dtsub3="${dtsub1}/subsub1" -mkdir -p ${dtsub3} +mkdir -p "${dtsub3}" # files f1="${dt}/file" subf1="${dtsub1}/file" subf2="${dtsub2}/file" subf3="${dtsub3}/file" -touch ${f1} ${subf1} ${subf2} ${subf3} +touch "${f1}" "${subf1}" "${subf2}" "${subf3}" # create the config file cfg="${tmps}/config.yaml" -cat > ${cfg} << _EOF +cat > "${cfg}" << _EOF config: backup: true create: true @@ -91,10 +92,10 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V --link=link_children ${dt} +cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p p1 -V --link=link_children "${dt}" # check is set to link_children -cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "d_`basename "${dt}"`" | grep ',link:link_children,' +cd "${ddpath}" | ${bin} files -c "${cfg}" -p p1 -V -G | grep "d_$(basename "${dt}")" | grep ',link:link_children,' # checks file exists in dotpath [ ! -e "${dotpath}"/"${dt}" ] && echo "dotfile not imported" && exit 1 diff --git a/tests-ng/include-order.sh b/tests-ng/include-order.sh index ec27bd2..69400d4 100755 --- a/tests-ng/include-order.sh +++ b/tests-ng/include-order.sh @@ -114,7 +114,7 @@ echo "second" > "${tmps}"/dotfiles/second echo "third" > "${tmps}"/dotfiles/third attempts="3" -for ((i=0;i<${attempts};i++)); do +for ((i=0;i "${cfg}" << _EOF config: diff --git a/tests-ng/update-templates.sh b/tests-ng/update-templates.sh index c4c128d..d20c62c 100755 --- a/tests-ng/update-templates.sh +++ b/tests-ng/update-templates.sh @@ -104,6 +104,7 @@ echo "tail" >> "${tmpd}"/abc set +e patch=$(cd "${ddpath}" | ${bin} update -P -p p1 -k f_abc --cfg "${cfg}" 2>&1 | grep 'try patching with' | sed 's/"//g') set -e +# shellcheck disable=SC2001 patch=$(echo "${patch}" | sed 's/^.*: //g') echo "patching with: ${patch}" eval "${patch}"