test(freset): update freset test

pull/17/head
Kevin Zhuang 4 years ago
parent c8e5a68d8f
commit 85066017be

@ -74,7 +74,7 @@ if [[ "${stash_command}" == "select" ]]; then
selected_files+=("${line}")
done < <(get_modified_file "select files to add to a stash")
[[ "${#selected_files[@]}" -eq 0 ]] && exit 1
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash -- "${selected_files[@]}"
git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash -- "${selected_files[@]}"
elif [[ "${stash_command}" == "delete" ]]; then
selected_stash=$(get_stash "select stash to delete")
[[ -z "${selected_stash}" ]] && exit 1
@ -85,7 +85,7 @@ elif [[ "${stash_command}" == "delete" ]]; then
[[ -z "${confirm}" ]] && confirm=$(get_confirmation)
[[ "${confirm}" != 'y' ]] && exit 1
while IFS= read -r line; do
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash drop "${line}"
git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash drop "${line}"
done <<< "${selected_stash}"
else
selected_stash=$(get_stash "select stash to apply" "true")
@ -93,5 +93,5 @@ else
[[ -z "${confirm}" ]] && echo "(dryrun) ${stash_command} ${selected_stash}"
[[ -z "${confirm}" ]] && confirm=$(get_confirmation)
[[ "${confirm}" != 'y' ]] && exit 1
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash "${stash_command}" "${selected_stash}"
git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash "${stash_command}" "${selected_stash}"
fi

@ -38,18 +38,16 @@ stash_apply() {
@test "fstash stash select file" {
run stash_file
[ "${status}" -eq 1 ]
[[ "${output}" =~ "stash" ]]
[[ "${output}" =~ "fstash_select" ]]
}
@test "fstash stash delete" {
run stash_delete
[ "${status}" -eq 1 ]
[[ "${output}" =~ "fstash_delete" ]]
[[ "${output}" =~ "stash drop fstash_delete" ]]
}
@test "fstash apply stash" {
run stash_apply
[ "${status}" -eq 1 ]
[[ "${output}" =~ "fstash_apply" ]]
[[ "${output}" =~ "stash apply fstash_apply" ]]
}

Loading…
Cancel
Save