(t *testing.T)
| 1120 | } |
| 1121 | |
| 1122 | func TestClientPathFromRootReturnsNestedPath(t *testing.T) { |
| 1123 | // Given a client operating from a nested repository directory |
| 1124 | repo := newTestRepo(t) |
| 1125 | nestedDir := filepath.Join(repo.dir, "some", "path") |
| 1126 | require.NoError(t, os.MkdirAll(nestedDir, 0700)) |
| 1127 | client := Client{RepoDir: nestedDir} |
| 1128 | |
| 1129 | // When its path relative to the repository root is requested |
| 1130 | dir := client.PathFromRoot(t.Context()) |
| 1131 | |
| 1132 | // Then the nested path is returned without a trailing separator |
| 1133 | assert.Equal(t, "some/path", filepath.ToSlash(dir)) |
| 1134 | } |
| 1135 | |
| 1136 | func TestClientPathFromRootReturnsEmptyOutsideRepository(t *testing.T) { |
| 1137 | // Given a client outside a Git repository |
nothing calls this directly
no test coverage detected