mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 20:03:59 +00:00
Merge pull request #215 from davla/master
Fixing banner issues in diff-cmd test
This commit is contained in:
@@ -74,28 +74,29 @@ cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/singlefile
|
|||||||
# modify the file
|
# modify the file
|
||||||
echo "modified" > ${tmpd}/singlefile
|
echo "modified" > ${tmpd}/singlefile
|
||||||
|
|
||||||
# normal diff
|
# suppressing the banner, so we can compare dotdrop diff with UNIX diff
|
||||||
echo "[+] comparing with normal diff"
|
export DOTDROP_NOBANNER=yes
|
||||||
|
|
||||||
|
# default diff (unified)
|
||||||
|
echo "[+] comparing with default diff (unified)"
|
||||||
set +e
|
set +e
|
||||||
cd ${ddpath} | ${bin} compare -c ${cfg} 2>&1 | grep -v '=>' > ${tmpd}/normal
|
cd ${ddpath} | ${bin} compare -c ${cfg} 2>&1 | grep -v '=>' | grep -v '^+++\|^---' > ${tmpd}/normal
|
||||||
diff -u -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile > ${tmpd}/real
|
diff -u -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile | grep -v '^+++\|^---' > ${tmpd}/real
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
#cat ${tmpd}/normal
|
diff ${tmpd}/normal ${tmpd}/real || exit 1
|
||||||
#cat ${tmpd}/real
|
|
||||||
diff <( tail -2 ${tmpd}/normal) <( tail -2 ${tmpd}/real) || exit 1
|
|
||||||
|
|
||||||
# adding unified diff
|
# adding normal diff
|
||||||
cfg2="${basedir}/config2.yaml"
|
cfg2="${basedir}/config2.yaml"
|
||||||
sed '/dotpath: dotfiles/a \ \ diff_command: "diff -r {0} {1}"' ${cfg} > ${cfg2}
|
sed '/dotpath: dotfiles/a \ \ diff_command: "diff -r {0} {1}"' ${cfg} > ${cfg2}
|
||||||
#cat ${cfg2}
|
#cat ${cfg2}
|
||||||
|
|
||||||
# unified diff
|
# normal diff
|
||||||
echo "[+] comparing with unified diff"
|
echo "[+] comparing with normal diff"
|
||||||
set +e
|
set +e
|
||||||
cd ${ddpath} | ${bin} compare -c ${cfg2} 2>&1 | grep -v '=>' | grep -v '^+++\|^---' > ${tmpd}/unified
|
cd ${ddpath} | ${bin} compare -c ${cfg2} 2>&1 | grep -v '=>' > ${tmpd}/unified
|
||||||
diff -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile | grep -v '^+++\|^---' > ${tmpd}/real
|
diff -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile > ${tmpd}/real
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
@@ -106,7 +107,7 @@ diff ${tmpd}/unified ${tmpd}/real || exit 1
|
|||||||
# adding fake diff
|
# adding fake diff
|
||||||
cfg3="${basedir}/config3.yaml"
|
cfg3="${basedir}/config3.yaml"
|
||||||
sed '/dotpath: dotfiles/a \ \ diff_command: "echo fakediff"' ${cfg} > ${cfg3}
|
sed '/dotpath: dotfiles/a \ \ diff_command: "echo fakediff"' ${cfg} > ${cfg3}
|
||||||
cat ${cfg3}
|
#cat ${cfg3}
|
||||||
|
|
||||||
# fake diff
|
# fake diff
|
||||||
echo "[+] comparing with fake diff"
|
echo "[+] comparing with fake diff"
|
||||||
@@ -115,11 +116,12 @@ cd ${ddpath} | ${bin} compare -c ${cfg3} 2>&1 | grep -v '=>' > ${tmpd}/fake
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
cat ${tmpd}/fake
|
#cat ${tmpd}/fake
|
||||||
grep fakediff ${tmpd}/fake || exit 1
|
grep fakediff ${tmpd}/fake &> /dev/null || exit 1
|
||||||
|
|
||||||
## CLEANING
|
## CLEANING
|
||||||
rm -rf ${basedir} ${tmpd}
|
rm -rf ${basedir} ${tmpd}
|
||||||
|
unset DOTDROP_NOBANNER
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user