Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deadc0de6 committed Nov 8, 2024
1 parent 60ba322 commit d564d19
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests-ng/import-with-key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ profiles:
_EOF
#cat ${cfg}

####################################################################################
# import
dkey="myfile1"
cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p p1 -V --dkey "${dkey}" "${tmpd}"/file1
Expand All @@ -62,6 +63,7 @@ cat "${cfg}"
[ ! -e "${tmps}"/dotfiles/"${tmpd}"/file1 ] && echo "not imported in dotpath" && exit 1
cat "${cfg}" | grep "${dkey}:" &>/dev/null || ( echo "bad key 1" && exit 1 )

####################################################################################
# import 2 files
echo "firstfile" > "${tmpd}"/firstfile
echo "secondfile" > "${tmpd}"/secondfile
Expand All @@ -76,6 +78,7 @@ cat "${cfg}"
cat "${cfg}" | grep "${dkey}:" &>/dev/null || ( echo "bad key 2a" && exit 1 )
cat "${cfg}" | grep "${dkey}_1:" &>/dev/null || ( echo "bad key 2b" && exit 1 )

####################################################################################
# import 2 files with bad chars
echo "file-1.1" > "${tmpd}"/file-1.1
echo "file-2.2" > "${tmpd}"/file-2.2
Expand All @@ -91,6 +94,7 @@ cat "${cfg}"
cat "${cfg}" | grep "${dkey_clean}:" &>/dev/null || ( echo "bad key 3a" && exit 1 )
cat "${cfg}" | grep "${dkey_clean}_1:" &>/dev/null || ( echo "bad key 3b" && exit 1 )

####################################################################################
# re-import
echo "lastfile" > "${tmpd}"/lastfile

Expand All @@ -102,6 +106,7 @@ cat "${cfg}"
[ ! -e "${tmps}"/dotfiles/"${tmpd}"/lastfile ] && echo "not imported in dotpath" && exit 1
cat "${cfg}" | grep "${dkey}_2:" &>/dev/null || ( echo "bad key 4" && exit 1 )

####################################################################################
# bad char
echo "firstfile" > "${tmpd}"/badchar

Expand All @@ -114,5 +119,17 @@ cat "${cfg}"
[ ! -e "${tmps}"/dotfiles/"${tmpd}"/badchar ] && echo "not imported in dotpath" && exit 1
cat "${cfg}" | grep "${dkey_clean}:" &>/dev/null || ( echo "bad key 5" && exit 1 )

####################################################################################
# empty dkey arg
echo "empty" > "${tmpd}"/empty

dkey=""
cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p p1 -V --dkey "${dkey}" "${tmpd}"/empty
cat "${cfg}"

# test
[ ! -e "${tmps}"/dotfiles/"${tmpd}"/empty ] && echo "not imported in dotpath" && exit 1
cat "${cfg}" | grep "f_empty" &>/dev/null || ( echo "bad key 2a" && exit 1 )

echo "OK"
exit 0

0 comments on commit d564d19

Please sign in to comment.