MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetCurrentBranchNotInRepo

Function TestGetCurrentBranchNotInRepo

pkg/cli/git_test.go:66–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestGetCurrentBranchNotInRepo(t *testing.T) {
67 tmpDir := testutil.TempDir(t, "test-*")
68
69 originalDir, err := os.Getwd()
70 require.NoError(t, err, "get current directory for test setup")
71 defer func() {
72 _ = os.Chdir(originalDir)
73 }()
74
75 require.NoError(t, os.Chdir(tmpDir), "change to temp directory for test setup")
76
77 // Don't initialize git - should error
78 _, err = getCurrentBranch()
79 assert.Error(t, err, "getCurrentBranch should return an error when not in a git repository")
80}
81
82func TestCreateAndSwitchBranch(t *testing.T) {
83 tmpDir := testutil.TempDir(t, "test-*")

Callers

nothing calls this directly

Calls 3

TempDirFunction · 0.92
getCurrentBranchFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected