test(fedit): update fedit test

pull/17/head
Kevin Zhuang 4 years ago
parent 42f530d611
commit 7f24d4319a

@ -59,7 +59,7 @@ done
if [[ "${edit_type}" == "commit" ]]; then
selected_commit=$(get_commit "select a commit to rename")
[[ -z "${selected_commit}" ]] && exit 1
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" rebase -i "${selected_commit}"~
git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" rebase -i "${selected_commit}"~
else
while IFS= read -r line; do
selected_files+=("${line}")

@ -41,15 +41,14 @@ edit_files() {
}
@test "fedit edit commits" {
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
skip
fi
run edit_commits
[[ "${output}" =~ "rebase -i" ]]
[[ "${output}" =~ "fedit_commits" ]]
}
@test "fedit edit files" {
run edit_files
# to avoid actually invoking vim, the fzf mock file exit without pringting anything
# when detecting the correct flag called with fzf
[ "${status}" -eq 1 ]
[ -z "${output}" ]
}

@ -30,12 +30,15 @@ elif [[ "$*" =~ '--header=select the target commit' ]] && [[ "$*" =~ "diff --col
elif [[ "$*" =~ '--header=select a file to checkout' ]] && [[ "$*" =~ "preview.sh ${DOTBARE_TREE}/{}" ]]; then
# dotbare fcheckout --yes -s -- "./fcheckout.bats" @test "fcheckout select"
echo "fcheckout_select_gitfile"
elif [[ "$*" =~ "--header=select a commit to rename --no-multi" ]] && [[ "$*" =~ "show --color=always" ]]; then
# dotbare fedit --commit -- "./fedit.bats" @test "fedit edit commits"
echo "fedit_commits"
elif [[ "$*" =~ "--header=select tracked files to edit" ]]; then
# dotbare fedit -- "./fedit.bats" @test "fedit edit files"
exit
elif [[ "$*" =~ '--no-multi --header=select the target commit for HEAD' ]] && [[ "$*" =~ "show --color" ]]; then
# dotbare freset --commit -y -- "./freset.bats" @test "freset select commit"
echo "--freset_commit"
elif [[ "$*" =~ "--no-multi --header=select a commit to rename" ]] && [[ "$*" =~ "show --color=always" ]]; then
# dotbare fedit --commit -- "./fedit.bats" @test "fedit edit commits"
echo "fedit_commits"
elif [[ "$*" =~ '--header=select a commit' ]] && [[ "$*" =~ "show --color" ]]; then
# dotbare flog --reset -y -- "./flog.bats" @test "flog reset"
echo "--flog_reset"
@ -54,9 +57,6 @@ elif [[ "$*" =~ '--header=select stash to apply' ]] && [[ "$*" =~ "show -p __ --
elif [[ "$*" =~ "--header=select files to unstage" ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
# dotbare freset -- "./freset.bats" @test "freset select files"
echo "-- freset_file"
elif [[ "$*" =~ "--header=select tracked files to edit" ]]; then
# dotbare fedit -- "./fedit.bats" @test "fedit edit files"
exit
elif [[ "$*" =~ "--no-multi --header=commit --flog_reset" ]]; then
# dotbare flog -- "./flog.bats" @test "flog checkout routing"
echo "exit"

Loading…
Cancel
Save