summaryrefslogtreecommitdiff
path: root/internal/git/git_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
committerPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
commit60f717b97ce6c375679080472750e60aab9dcd8f (patch)
treeb1028ea0e51ce6134ed3ea06da2a7205457319c5 /internal/git/git_test.go
parent526e3bd1bea7e2ef67c6984b91cdb9b3ac3be4e5 (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.go13
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 {