1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 11:01:45 +00:00

test verbosity

This commit is contained in:
deadc0de6
2024-08-20 22:28:37 +02:00
committed by deadc0de
parent d7eaee66dc
commit a617b95c1d
2 changed files with 11 additions and 1 deletions

6
tests-ng/backup.sh vendored
View File

@@ -32,6 +32,8 @@ grep_or_fail()
{
if ! grep "${1}" "${2}" >/dev/null 2>&1; then
echo "pattern \"${1}\" not found in ${2}"
echo "content:"
cat "${2}"
exit 1
fi
}
@@ -143,6 +145,7 @@ clear_dotpath
clear_fs
create_dotpath
create_fs
echo "doing test \"${pre}\""
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose
# checks
@@ -177,6 +180,7 @@ clear_dotpath
clear_fs
create_dotpath
create_fs
echo "doing test \"${pre}\""
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose
# checks
@@ -199,6 +203,7 @@ clear_dotpath
clear_fs
create_dotpath
create_fs
echo "doing test \"${pre}\""
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose
# checks
@@ -221,6 +226,7 @@ clear_dotpath
clear_fs
create_dotpath
create_fs
echo "doing test \"${pre}\""
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose
# checks

View File

@@ -57,6 +57,7 @@ noprofile="ALL"
##################################
# import with profile from arg
echo "import with profile from arg"
cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p "${noprofile}" -V "${tmpd}"/file1
cat "${cfg}"
@@ -71,11 +72,13 @@ nb=$(cat "${cfg}" | grep f_file1 | wc -l)
cntpre=$(find "${tmps}"/dotfiles -type f | wc -l)
# reimport
echo "reimport"
set +e
cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p "${noprofile}" -V "${tmpd}"/file1
set -e
cat "${cfg}"
echo "test reimport"
cntpost=$(find "${tmps}"/dotfiles -type f | wc -l)
[ "${cntpost}" != "${cntpre}" ] && echo "imported twice" && exit 1
@@ -84,6 +87,7 @@ nb=$(cat "${cfg}" | grep "dst: ${tmpd}/file1" | wc -l)
##################################
# import with profile from env
echo "import with profile from env"
export DOTDROP_PROFILE="${noprofile}"
cd "${ddpath}" | ${bin} import -f -c "${cfg}" -V "${tmpd}"/file2
cat "${cfg}"
@@ -91,7 +95,7 @@ cat "${cfg}"
# ensure exists and is not link
[ ! -e "${tmps}"/dotfiles/"${tmpd}"/file2 ] && echo "file not imported" && exit 1
# ensure present in config
cat "${cfg}" | grep "${tmpd}"/file2 >/dev/null 2>&1
cat "${cfg}" | grep "${tmpd}"/file2 >/dev/null 2>&1 || (echo "file2 not present in config" && exit 1)
nb=$(cat "${cfg}" | grep f_file2 | wc -l)
[ "${nb}" != "1" ] && echo 'bad config' && exit 1