Skip to content

Commit

Permalink
test verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
deadc0de6 committed Aug 20, 2024
1 parent c317999 commit 07551b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests-ng/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests-ng/import-to-no-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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

Expand All @@ -84,14 +87,15 @@ 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}"

# 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
Expand Down

0 comments on commit 07551b4

Please sign in to comment.