diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-18 08:47:27 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-18 08:47:27 +0300 |
| commit | 60f717b97ce6c375679080472750e60aab9dcd8f (patch) | |
| tree | b1028ea0e51ce6134ed3ea06da2a7205457319c5 /internal/git/git_test.go | |
| parent | 526e3bd1bea7e2ef67c6984b91cdb9b3ac3be4e5 (diff) | |
refactor: move Gitter interface to consumer package internal/cli (task p6)
Per Go best practice (100 Go Mistakes #6): interfaces belong where they are
used, not where they are implemented. Move Gitter from internal/git to
internal/cli/git.go. Compile-time assertions (var _ Gitter = ...) kept in
the new location. internal/git retains concrete *Git and *NoOp types.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/git/git_test.go')
| -rw-r--r-- | internal/git/git_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/git/git_test.go b/internal/git/git_test.go index 462c747..4c22fec 100644 --- a/internal/git/git_test.go +++ b/internal/git/git_test.go @@ -283,11 +283,14 @@ func TestIsGitRepo_outside(t *testing.T) { } } -// TestNoOp_satisfies_Gitter verifies that *git.NoOp compiles as a Gitter and -// that all its methods return nil (no-op, no error) so they are safe to call -// unconditionally from CLI dispatch. -func TestNoOp_satisfies_Gitter(t *testing.T) { - var g git.Gitter = git.NewNoOp() +// TestNoOp_methods verifies that all *git.NoOp methods return nil (no-op, no +// error) so they are safe to call unconditionally from CLI dispatch. +// +// Note: the Gitter interface is defined in internal/cli (the consumer), not +// here in internal/git (the producer), per Go best practice #6. The +// compile-time assertion that *NoOp satisfies Gitter lives in internal/cli/git.go. +func TestNoOp_methods(t *testing.T) { + g := git.NewNoOp() ctx := context.Background() table := []struct { |
