(t *testing.T)
| 75 | } |
| 76 | |
| 77 | func TestGetRepositoryRoot_FromSubdirectory(t *testing.T) { |
| 78 | tmpDir := t.TempDir() |
| 79 | setupGitRepo(t, tmpDir) |
| 80 | |
| 81 | // Create subdirectory |
| 82 | subDir := filepath.Join(tmpDir, "lib", "src") |
| 83 | err := os.MkdirAll(subDir, 0755) |
| 84 | require.NoError(t, err) |
| 85 | |
| 86 | root, err := GetRepositoryRoot(subDir) |
| 87 | |
| 88 | require.NoError(t, err) |
| 89 | resolvedTmp, _ := filepath.EvalSymlinks(tmpDir) |
| 90 | assert.Equal(t, resolvedTmp, root) |
| 91 | } |
| 92 | |
| 93 | func TestGetRepositoryRoot_NotGitRepo(t *testing.T) { |
| 94 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected