mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 05:09:17 +00:00
adding more tests
This commit is contained in:
@@ -60,7 +60,13 @@ cat > ${cfg} << _EOF
|
|||||||
actions:
|
actions:
|
||||||
pre:
|
pre:
|
||||||
preaction: echo 'pre' > ${tmpa}/pre
|
preaction: echo 'pre' > ${tmpa}/pre
|
||||||
|
preaction2: echo 'pre2' > ${tmpa}/pre2
|
||||||
|
preaction3: echo 'pre3' > ${tmpa}/pre3
|
||||||
|
multiple: echo 'multiple' >> ${tmpa}/multiple
|
||||||
|
multiple2: echo 'multiple2' >> ${tmpa}/multiple2
|
||||||
nakedaction: echo 'naked' > ${tmpa}/naked
|
nakedaction: echo 'naked' > ${tmpa}/naked
|
||||||
|
nakedaction2: echo 'naked2' > ${tmpa}/naked2
|
||||||
|
nakedaction3: echo 'naked3' > ${tmpa}/naked3
|
||||||
config:
|
config:
|
||||||
backup: true
|
backup: true
|
||||||
create: true
|
create: true
|
||||||
@@ -72,25 +78,73 @@ dotfiles:
|
|||||||
actions:
|
actions:
|
||||||
- preaction
|
- preaction
|
||||||
- nakedaction
|
- nakedaction
|
||||||
|
f_link:
|
||||||
|
dst: ${tmpd}/link
|
||||||
|
src: link
|
||||||
|
link: true
|
||||||
|
actions:
|
||||||
|
- preaction2
|
||||||
|
- nakedaction2
|
||||||
|
d_dir:
|
||||||
|
dst: ${tmpd}/dir
|
||||||
|
src: dir
|
||||||
|
actions:
|
||||||
|
- multiple
|
||||||
|
d_dlink:
|
||||||
|
dst: ${tmpd}/dlink
|
||||||
|
src: dlink
|
||||||
|
link: true
|
||||||
|
actions:
|
||||||
|
- preaction3
|
||||||
|
- nakedaction3
|
||||||
|
- multiple2
|
||||||
profiles:
|
profiles:
|
||||||
p1:
|
p1:
|
||||||
dotfiles:
|
dotfiles:
|
||||||
- f_abc
|
- f_abc
|
||||||
|
- f_link
|
||||||
|
- d_dir
|
||||||
|
- d_dlink
|
||||||
_EOF
|
_EOF
|
||||||
cat ${cfg}
|
cat ${cfg}
|
||||||
|
|
||||||
# create the dotfile
|
# create the dotfile
|
||||||
echo "test" > ${tmps}/dotfiles/abc
|
echo 'test' > ${tmps}/dotfiles/abc
|
||||||
|
echo 'link' > ${tmps}/dotfiles/link
|
||||||
|
|
||||||
|
mkdir -p ${tmps}/dotfiles/dir
|
||||||
|
echo 'test1' > ${tmps}/dotfiles/dir/file1
|
||||||
|
echo 'test2' > ${tmps}/dotfiles/dir/file2
|
||||||
|
|
||||||
|
mkdir -p ${tmps}/dotfiles/dlink
|
||||||
|
echo 'test3' > ${tmps}/dotfiles/dlink/dfile1
|
||||||
|
echo 'test4' > ${tmps}/dotfiles/dlink/dfile2
|
||||||
|
|
||||||
# install
|
# install
|
||||||
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1
|
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
||||||
|
|
||||||
# checks
|
# checks
|
||||||
[ ! -e ${tmpa}/pre ] && exit 1
|
[ ! -e ${tmpa}/pre ] && echo 'pre action not executed' && exit 1
|
||||||
grep pre ${tmpa}/pre >/dev/null
|
grep pre ${tmpa}/pre >/dev/null
|
||||||
[ ! -e ${tmpa}/naked ] && exit 1
|
[ ! -e ${tmpa}/naked ] && echo 'naked action not executed' && exit 1
|
||||||
grep naked ${tmpa}/naked >/dev/null
|
grep naked ${tmpa}/naked >/dev/null
|
||||||
|
|
||||||
|
[ ! -e ${tmpa}/multiple ] && echo 'pre action multiple not executed' && exit 1
|
||||||
|
grep multiple ${tmpa}/multiple >/dev/null
|
||||||
|
[ "`wc -l ${tmpa}/multiple | awk '{print $1}'`" -gt "1" ] && echo 'pre action multiple executed twice' && exit 1
|
||||||
|
|
||||||
|
[ ! -e ${tmpa}/pre2 ] && echo 'pre action 2 not executed' && exit 1
|
||||||
|
grep pre2 ${tmpa}/pre2 >/dev/null
|
||||||
|
[ ! -e ${tmpa}/naked2 ] && echo 'naked action 2 not executed' && exit 1
|
||||||
|
grep naked2 ${tmpa}/naked2 >/dev/null
|
||||||
|
|
||||||
|
[ ! -e ${tmpa}/multiple2 ] && echo 'pre action multiple 2 not executed' && exit 1
|
||||||
|
grep multiple2 ${tmpa}/multiple2 >/dev/null
|
||||||
|
[ "`wc -l ${tmpa}/multiple2 | awk '{print $1}'`" -gt "1" ] && echo 'pre action multiple 2 executed twice' && exit 1
|
||||||
|
[ ! -e ${tmpa}/naked3 ] && echo 'naked action 3 not executed' && exit 1
|
||||||
|
grep naked3 ${tmpa}/naked3 >/dev/null
|
||||||
|
|
||||||
|
|
||||||
# remove the pre action result and re-run
|
# remove the pre action result and re-run
|
||||||
rm ${tmpa}/pre
|
rm ${tmpa}/pre
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user