TestSpec_Variables_ErrNotGitRepository validates the documented sentinel-error contract for ErrNotGitRepository. Specification (Variables + Behavioral contracts): - ErrNotGitRepository is the sentinel error returned by FindGitRoot and FindGitRootFrom when no .git entry is found while traversing up
(t *testing.T)
| 347 | // The README usage example relies on errors.Is(err, gitutil.ErrNotGitRepository), |
| 348 | // so the returned error must satisfy that comparison. |
| 349 | func TestSpec_Variables_ErrNotGitRepository(t *testing.T) { |
| 350 | require.Error(t, gitutil.ErrNotGitRepository, |
| 351 | "ErrNotGitRepository should be a non-nil sentinel error value") |
| 352 | |
| 353 | // A directory created outside any git repository should surface the |
| 354 | // documented sentinel error. |
| 355 | isolated := t.TempDir() |
| 356 | _, err := gitutil.FindGitRootFrom(isolated) |
| 357 | require.Error(t, err, |
| 358 | "FindGitRootFrom should error when startDir is not inside a git repository") |
| 359 | assert.ErrorIs(t, err, gitutil.ErrNotGitRepository, |
| 360 | "FindGitRootFrom should return the documented ErrNotGitRepository sentinel") |
| 361 | } |
| 362 | |
| 363 | // TestSpec_PublicAPI_ReadFileFromHEAD validates the documented behavior of |
| 364 | // ReadFileFromHEAD as described in the package README.md. |
nothing calls this directly
no test coverage detected