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

Function TestWorktreeForBranchReturnsExactMatch

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

Source from the content-addressed store, hash-verified

1984}
1985
1986func TestWorktreeForBranchReturnsExactMatch(t *testing.T) {
1987 // Given worktrees for main and a nested feature branch
1988 worktrees := []Worktree{
1989 {Path: "/path/to/main", Ref: "refs/heads/main"},
1990 {Path: "/path/to/feature", Ref: "refs/heads/feature/one"},
1991 }
1992
1993 // When the nested feature branch is located
1994 worktree := WorktreeForBranch(worktrees, "feature/one")
1995
1996 // Then its exact worktree is returned
1997 assert.Equal(t, &worktrees[1], worktree)
1998}
1999
2000func TestWorktreeForBranchRejectsNonMatchingBranch(t *testing.T) {
2001 worktrees := []Worktree{

Callers

nothing calls this directly

Calls 2

WorktreeForBranchFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected