From 85066017be4f7c56356508de3c2bf919333de674 Mon Sep 17 00:00:00 2001 From: Kevin Zhuang Date: Tue, 7 Jul 2020 15:15:18 +1000 Subject: [PATCH] test(freset): update freset test --- scripts/fstash | 6 +++--- tests/fstash.bats | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/fstash b/scripts/fstash index 62e170b..e0d3a01 100755 --- a/scripts/fstash +++ b/scripts/fstash @@ -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 diff --git a/tests/fstash.bats b/tests/fstash.bats index bad27e7..31277fd 100755 --- a/tests/fstash.bats +++ b/tests/fstash.bats @@ -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" ]] }