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

Function TestClientCurrentBranchReturnsCurrentBranch

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

Source from the content-addressed store, hash-verified

256}
257
258func TestClientCurrentBranchReturnsCurrentBranch(t *testing.T) {
259 // Given a repository checked out on a branch containing non-breaking spaces
260 repo := newTestRepo(t)
261 branchName := "branch\u00A0with\u00A0non\u00A0breaking\u00A0space"
262 repo.run(t, "checkout", "--quiet", "-b", branchName)
263
264 // When the current branch is requested
265 branch, err := repo.client.CurrentBranch(t.Context())
266
267 // Then the complete branch name is returned
268 require.NoError(t, err)
269 assert.Equal(t, branchName, branch)
270}
271
272func TestClientCurrentBranchReportsDetachedHead(t *testing.T) {
273 // Given a repository with a detached HEAD

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected