1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-12 18:10:15 +00:00

update tests

This commit is contained in:
deadc0de6
2021-07-15 09:35:22 +02:00
parent 5771e65163
commit 8611867ac3

View File

@@ -59,7 +59,7 @@ cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF cat > ${cfg} << _EOF
actions: actions:
clearemptydir: find -L '{0}' -empty -type d -delete clearemptydir: find -L '{0}' -empty -xtype d -delete
config: config:
backup: true backup: true
create: true create: true
@@ -82,11 +82,21 @@ dotfiles:
- clearemptydir ${tmpd}/dir2 - clearemptydir ${tmpd}/dir2
instignore: instignore:
- '*ignore' - '*ignore'
f_dir3:
dst: ${tmpd}/dir3
src: dir3
link: link
ignoreempty: true
actions:
- clearemptydir ${tmpd}/dir3
instignore:
- '*ignore'
profiles: profiles:
p1: p1:
dotfiles: dotfiles:
- f_dir1 - f_dir1
- f_dir2 - f_dir2
- f_dir3
_EOF _EOF
#cat ${cfg} #cat ${cfg}
@@ -110,8 +120,18 @@ mkdir ${tmps}/dotfiles/dir2/sub
mkdir ${tmps}/dotfiles/dir2/sub/empty mkdir ${tmps}/dotfiles/dir2/sub/empty
echo "{{@@ profile @@}}" > ${tmps}/dotfiles/dir2/sub/empty/that.ignore echo "{{@@ profile @@}}" > ${tmps}/dotfiles/dir2/sub/empty/that.ignore
# create the dotfile
mkdir ${tmps}/dotfiles/dir3
mkdir ${tmps}/dotfiles/dir3/empty
echo "{{@@ profile @@}}" > ${tmps}/dotfiles/dir3/empty/this.ignore
mkdir ${tmps}/dotfiles/dir3/not-empty
echo "{{@@ profile @@}}" > ${tmps}/dotfiles/dir3/not-empty/file
mkdir ${tmps}/dotfiles/dir3/sub
mkdir ${tmps}/dotfiles/dir3/sub/empty
echo "{{@@ profile @@}}" > ${tmps}/dotfiles/dir3/sub/empty/that.ignore
# install # install
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V # 2>&1 | tee ${tmpa}/log cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
# checks normal # checks normal
[ ! -d ${tmpd}/dir1 ] && exit 1 [ ! -d ${tmpd}/dir1 ] && exit 1
@@ -137,9 +157,23 @@ grep "file" ${tmpd}/dir1/not-empty/file
[ -e ${tmpd}/dir2/sub/empty/that.ignore ] && exit 1 [ -e ${tmpd}/dir2/sub/empty/that.ignore ] && exit 1
grep "p1" ${tmpd}/dir2/not-empty/file grep "p1" ${tmpd}/dir2/not-empty/file
# checks link
[ ! -d ${tmpd}/dir3 ] && exit 1
[ ! -h ${tmpd}/dir3 ] && exit 1
[ -d ${tmpd}/dir3/empty ] && exit 1
[ -e ${tmpd}/dir3/empty/this.ignore ] && exit 1
[ ! -d ${tmpd}/dir3/not-empty ] && exit 1
[ ! -e ${tmpd}/dir3/not-empty/file ] && exit 1
[ -d ${tmpd}/dir3/sub ] && exit 1
[ -d ${tmpd}/dir3/sub/empty ] && exit 1
[ -e ${tmpd}/dir3/sub/empty/that.ignore ] && exit 1
grep "p1" ${tmpd}/dir3/not-empty/file
# second install won't trigger the action # second install won't trigger the action
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V # 2>&1 | tee ${tmpa}/log cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V # 2>&1 | tee ${tmpa}/log
set -e
# check normal # check normal
[ -d ${tmpd}/dir1/empty ] && echo "empty directory not cleaned" && exit 1 [ -d ${tmpd}/dir1/empty ] && echo "empty directory not cleaned" && exit 1
[ -d ${tmpd}/dir1/sub/empty ] && echo "empty directory not cleaned" && exit 1 [ -d ${tmpd}/dir1/sub/empty ] && echo "empty directory not cleaned" && exit 1
@@ -148,6 +182,10 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V # 2>&1 | tee ${tmpa}/log
[ -d ${tmpd}/dir2/empty ] && echo "empty directory not cleaned" && exit 1 [ -d ${tmpd}/dir2/empty ] && echo "empty directory not cleaned" && exit 1
[ -d ${tmpd}/dir2/sub/empty ] && echo "empty directory not cleaned" && exit 1 [ -d ${tmpd}/dir2/sub/empty ] && echo "empty directory not cleaned" && exit 1
# check link
[ -d ${tmpd}/dir3/empty ] && echo "empty directory not cleaned" && exit 1
[ -d ${tmpd}/dir3/sub/empty ] && echo "empty directory not cleaned" && exit 1
## CLEANING ## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa} rm -rf ${tmps} ${tmpd} ${tmpa}