From d24f33b679d8a0e789abe48772a37c8191326604 Mon Sep 17 00:00:00 2001 From: Shi Han NG Date: Sat, 1 Aug 2020 19:23:28 +0900 Subject: [PATCH] Add Test_RepoClone_flagError --- pkg/cmd/repo/clone/clone_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/cmd/repo/clone/clone_test.go b/pkg/cmd/repo/clone/clone_test.go index c732c8bfe..96bb2bad1 100644 --- a/pkg/cmd/repo/clone/clone_test.go +++ b/pkg/cmd/repo/clone/clone_test.go @@ -179,3 +179,13 @@ func Test_RepoClone_withoutUsername(t *testing.T) { assert.Equal(t, 1, cs.Count) assert.Equal(t, "git clone https://github.com/OWNER/REPO.git", strings.Join(cs.Calls[0].Args, " ")) } + +func Test_RepoClone_flagError(t *testing.T) { + reg := &httpmock.Registry{} + httpClient := &http.Client{Transport: reg} + + _, err := runCloneCommand(httpClient, "--depth 1 OWNER/REPO") + if err == nil || err.Error() != "unknown flag: --depth\nSeparate git clone flags with `--`." { + t.Errorf("unexpected error %v", err) + } +}