1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-12 20:25:17 +00:00

fix tests

This commit is contained in:
deadc0de6
2023-09-21 14:31:18 +02:00
committed by deadc0de
parent 341f90bd75
commit 70b742a9f3

27
tests-ng/backup.sh vendored
View File

@@ -36,20 +36,19 @@ grep_or_fail()
} }
# the dotfile source # the dotfile source
tmps=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) tmps=$(mktemp -d --suffix='-dotdrop-tests-dotpath' || mktemp -d)
mkdir -p "${tmps}"/dotfiles mkdir -p "${tmps}"/dotfiles
# the dotfile destination # the dotfile destination
tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d) tmpd=$(mktemp -d --suffix='-dotdrop-tests-dst' || mktemp -d)
tmpw=$(mktemp -d --suffix='-dotdrop-workdir' || mktemp -d)
clear_on_exit "${tmps}" clear_on_exit "${tmps}"
clear_on_exit "${tmpd}" clear_on_exit "${tmpd}"
clear_on_exit "${tmpw}"
clear_dotpath() clear_dotpath()
{ {
rm -f "${tmps}"/dotfiles/file rm -rf "${tmps:?}"/dotfiles/*
rm -f "${tmps}"/dotfiles/template
rm -rf "${tmps}"/dotfiles/dir
rm -rf "${tmps}"/dotfiles/tree
} }
create_dotpath() create_dotpath()
@@ -70,10 +69,7 @@ create_dotpath()
clear_fs() clear_fs()
{ {
rm -f "${tmpd}"/file rm -rf "${tmpd:?}"/*
rm -f "${tmpd}"/template
rm -rf "${tmpd}"/dir
rm -rf "${tmpd}"/tree
} }
create_fs() create_fs()
@@ -104,6 +100,7 @@ config:
create: true create: true
dotpath: dotfiles dotpath: dotfiles
link_dotfile_default: ${1} link_dotfile_default: ${1}
workdir: ${tmpw}
dotfiles: dotfiles:
f_file: f_file:
dst: ${tmpd}/file dst: ${tmpd}/file
@@ -129,7 +126,7 @@ _EOF
} }
# install nolink # install nolink
pre="nolink" pre="link:nolink"
create_config "nolink" create_config "nolink"
clear_dotpath clear_dotpath
clear_fs clear_fs
@@ -164,12 +161,14 @@ grep_or_fail modified "${tmpd}"/tree/sub/file
grep_or_fail p1 "${tmpd}"/tree/sub/template grep_or_fail p1 "${tmpd}"/tree/sub/template
# install relative # install relative
pre="relative" pre="link:relative"
create_config "relative" create_config "relative"
clear_dotpath clear_dotpath
clear_fs clear_fs
create_dotpath create_dotpath
create_fs create_fs
tree "${tmps}"/dotfiles
tree "${tmpd}"
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose
# checks # checks
@@ -199,7 +198,7 @@ grep_or_fail modified "${tmpd}"/tree/sub/file
grep_or_fail p1 "${tmpd}"/tree/sub/template grep_or_fail p1 "${tmpd}"/tree/sub/template
# install absolute # install absolute
pre="absolute" pre="link:absolute"
create_config "absolute" create_config "absolute"
clear_dotpath clear_dotpath
clear_fs clear_fs
@@ -234,7 +233,7 @@ grep_or_fail modified "${tmpd}"/tree/sub/file
grep_or_fail p1 "${tmpd}"/tree/sub/template grep_or_fail p1 "${tmpd}"/tree/sub/template
# install link_children # install link_children
pre="link_children" pre="link:link_children"
create_config "link_children" create_config "link_children"
clear_dotpath clear_dotpath
clear_fs clear_fs