From: Jacob Keller Date: Sat, 25 Apr 2020 02:20:34 GMT Subject: [PATCH 01/11] completion: add some simple test cases for git switch completion Message-ID: <20200425022045.1089291-2-jacob.e.keller@intel.com> In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> From: Jacob Keller Future work is going to refactor the completion support for git switch, so add some new test cases in order to help prevent regressions. Signed-off-by: Jacob Keller --- t/t9902-completion.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 5505e5aa249e..03e8188f023d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1240,6 +1240,31 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' ' test_cmp expected out ' +test_expect_success 'git switch - with --no-guess, complete only local branches' ' + test_completion "git switch --no-guess " <<-\EOF + master Z + matching-branch Z + EOF +' + +test_expect_success 'git switch - with --detach, complete all references' ' + test_completion "git switch --detach " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +test_expect_success 'git switch - with --no-track, complete only local branch names' ' + test_completion "git switch --no-track " <<-\EOF + master Z + matching-branch Z + EOF +' + test_expect_success 'teardown after ref completion' ' git branch -d matching-branch && git tag -d matching-tag && -- 2.25.2