MCPcopy Create free account
hub / github.com/cli/cli / TestClientCheckoutBranchSwitchesBranches

Function TestClientCheckoutBranchSwitchesBranches

git/client_test.go:1003–1015  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1001}
1002
1003func TestClientCheckoutBranchSwitchesBranches(t *testing.T) {
1004 // Given a repository checked out on feature with a trunk branch
1005 repo := newTestRepo(t)
1006 repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit")
1007 repo.run(t, "checkout", "--quiet", "-b", "feature")
1008
1009 // When trunk is checked out
1010 err := repo.client.CheckoutBranch(t.Context(), "trunk")
1011
1012 // Then trunk becomes the current branch
1013 require.NoError(t, err)
1014 assert.Equal(t, "trunk", repo.run(t, "branch", "--show-current"))
1015}
1016
1017func TestClientCheckoutBranchReportsMissingBranch(t *testing.T) {
1018 // Given a repository without the requested branch

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
EqualMethod · 0.80
CheckoutBranchMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected