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

Function TestSpec_PublicAPI_FindGitRoot

pkg/gitutil/spec_test.go:284–292  ·  view source on GitHub ↗

TestSpec_PublicAPI_FindGitRoot validates the documented behavior of FindGitRoot as described in the package README.md. Specification: Returns the absolute path of the root directory of the current Git repository using pure Go filesystem traversal (no `git` subprocess); starts from the current worki

(t *testing.T)

Source from the content-addressed store, hash-verified

282// Git repository using pure Go filesystem traversal (no `git` subprocess);
283// starts from the current working directory.
284func TestSpec_PublicAPI_FindGitRoot(t *testing.T) {
285 t.Run("returns non-empty absolute path when in git repository", func(t *testing.T) {
286 root, err := gitutil.FindGitRoot()
287 require.NoError(t, err, "FindGitRoot should not error when inside a git repository")
288 assert.NotEmpty(t, root, "FindGitRoot should return a non-empty path")
289 assert.True(t, filepath.IsAbs(root),
290 "FindGitRoot should return an absolute path, got %q", root)
291 })
292}
293
294// TestSpec_PublicAPI_FindGitRootFrom validates the documented behavior of
295// FindGitRootFrom as described in the package README.md.

Callers

nothing calls this directly

Calls 2

FindGitRootFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected