From a31281d3ebdfe5367e2729ae5e83659ff119efe0 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Thu, 28 Dec 2023 09:45:24 +0100 Subject: [PATCH] more tests --- tests-ng/ignore-patterns-negative.sh | 70 +++++++++++++++++++--------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/tests-ng/ignore-patterns-negative.sh b/tests-ng/ignore-patterns-negative.sh index 2c622e7..309690e 100755 --- a/tests-ng/ignore-patterns-negative.sh +++ b/tests-ng/ignore-patterns-negative.sh @@ -199,26 +199,26 @@ cd "${ddpath}" | ${bin} install -f -c "${cfg2}" -p p1 -V clean_both create_in_dotpath create_in_dst -rm -rf "${dotpath}/mpv/watch_later" +rm -r "${dotpath}/mpv/watch_later" cd "${ddpath}" | ${bin} update -f -c "${cfg1}" -p p1 -V -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "update (cfg1) 1 failed" && exit 1 -[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "update (cfg1) 2 failed" && exit 1 -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "update (cfg1) 3 failed" && exit 1 -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "update (cfg1) 4 failed" && exit 1 -[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "update (cfg1) 5 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepme" ] && echo "update (cfg1) 1 failed" && exit 1 +[ ! -d "${dotpath}/mpv/watch_later/keepmetoo" ] && echo "update (cfg1) 2 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "update (cfg1) 3 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "update (cfg1) 4 failed" && exit 1 +[ -e "${dotpath}/mpv/watch_later/watch_later_file" ] && echo "update (cfg1) 5 failed" && exit 1 clean_both create_in_dotpath create_in_dst -rm -rf "${dotpath}/mpv/watch_later" +rm -r "${dotpath}/mpv/watch_later" cd "${ddpath}" | ${bin} update -f -c "${cfg2}" -p p1 -V -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "update (cfg2) 1 failed" && exit 1 -[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "update (cfg2) 2 failed" && exit 1 -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "update (cfg2) 3 failed" && exit 1 -[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "update (cfg2) 4 failed" && exit 1 -[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "update (cfg2) 5 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepme" ] && echo "update (cfg2) 1 failed" && exit 1 +[ ! -d "${dotpath}/mpv/watch_later/keepmetoo" ] && echo "update (cfg2) 2 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "update (cfg2) 3 failed" && exit 1 +[ ! -e "${dotpath}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "update (cfg2) 4 failed" && exit 1 +[ -e "${dotpath}/mpv/watch_later/watch_later_file" ] && echo "update (cfg2) 5 failed" && exit 1 ################################################### # test import @@ -250,30 +250,58 @@ clean_both create_in_dst create_in_dotpath -rm -rf "${dotpath}/mpv/watch_later" +rm "${dotpath}/mpv/watch_later/watch_later_file" +# this should succeed (no diff) cd "${ddpath}" | ${bin} compare -c "${cfg1}" -p p1 -V +rm -r "${dotpath}/mpv/watch_later" +set +e +# this should fail +cd "${ddpath}" | ${bin} compare -c "${cfg1}" -p p1 -V && echo "compare cfg1 1 should failed" && exit 1 +set -e + clean_both create_in_dst create_in_dotpath -rm -rf "${tmpd}/mpv/watch_later" +rm "${tmpd}/mpv/watch_later/watch_later_file" +# this should succeed (no diff) cd "${ddpath}" | ${bin} compare -c "${cfg1}" -p p1 -V -clean_both -create_in_dst -create_in_dotpath - -rm -rf "${dotpath}/mpv/watch_later" -cd "${ddpath}" | ${bin} compare -c "${cfg2}" -p p1 -V +rm -r "${tmpd}/mpv/watch_later" +set +e +# this should fail +cd "${ddpath}" | ${bin} compare -c "${cfg1}" -p p1 -V && echo "compare cfg1 2 should failed" && exit 1 +set -e clean_both create_in_dst create_in_dotpath -rm -rf "${tmpd}/mpv/watch_later" +rm "${dotpath}/mpv/watch_later/watch_later_file" +# this should succeed (no diff) cd "${ddpath}" | ${bin} compare -c "${cfg2}" -p p1 -V +rm -r "${dotpath}/mpv/watch_later" +set +e +# this should fail +cd "${ddpath}" | ${bin} compare -c "${cfg2}" -p p1 -V && echo "compare cfg2 1 should failed" && exit 1 +set -e + +clean_both +create_in_dst +create_in_dotpath + +rm "${tmpd}/mpv/watch_later/watch_later_file" +# this should succeed (no diff) +cd "${ddpath}" | ${bin} compare -c "${cfg2}" -p p1 -V + +rm -r "${tmpd}/mpv/watch_later" +set +e +# this should fail +cd "${ddpath}" | ${bin} compare -c "${cfg2}" -p p1 -V && echo "compare cfg2 2 should failed" && exit 1 +set -e + ################################################### echo "OK"