1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-11 20:03:59 +00:00

fix diff tests

This commit is contained in:
deadc0de6
2020-01-27 08:10:25 +01:00
parent d54f0eb465
commit adc4581533

View File

@@ -78,24 +78,24 @@ echo "modified" > ${tmpd}/singlefile
echo "[+] comparing with normal diff" echo "[+] comparing with normal diff"
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 '=>' > ${tmpd}/normal
diff -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile > ${tmpd}/real diff -u -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile > ${tmpd}/real
set -e set -e
# verify # verify
#cat ${tmpd}/normal #cat ${tmpd}/normal
#cat ${tmpd}/real #cat ${tmpd}/real
diff ${tmpd}/normal ${tmpd}/real || exit 1 diff <( tail -2 ${tmpd}/normal) <( tail -2 ${tmpd}/real) || exit 1
# adding unified diff # adding unified diff
cfg2="${basedir}/config2.yaml" cfg2="${basedir}/config2.yaml"
sed '/dotpath: dotfiles/a \ \ diff_command: "diff -u {0} {1}"' ${cfg} > ${cfg2} sed '/dotpath: dotfiles/a \ \ diff_command: "diff -r {0} {1}"' ${cfg} > ${cfg2}
#cat ${cfg2} #cat ${cfg2}
# unified diff # unified diff
echo "[+] comparing with unified diff" echo "[+] comparing with unified 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 '=>' | grep -v '^+++\|^---' > ${tmpd}/unified
diff -u ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile | grep -v '^+++\|^---' > ${tmpd}/real diff -r ${tmpd}/singlefile ${basedir}/dotfiles/${tmpd}/singlefile | grep -v '^+++\|^---' > ${tmpd}/real
set -e set -e
# verify # verify