MCPcopy Create free account
hub / github.com/diillson/chatcli / TestHandleGitDiff

Function TestHandleGitDiff

pkg/coder/engine/commands_git_test.go:93–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestHandleGitDiff(t *testing.T) {
94 dir := newGitRepo(t)
95 // Modify the tracked file so diff has content.
96 if err := os.WriteFile(filepath.Join(dir, "tracked.txt"), []byte("hello\nworld\n"), 0600); err != nil {
97 t.Fatal(err)
98 }
99 e, out := newGitTestEngine()
100 if err := e.Execute(context.Background(), "git-diff", []string{"--dir", dir, "--context", "1"}); err != nil {
101 t.Fatalf("git-diff: %v", err)
102 }
103 if !strings.Contains(out.String(), "world") {
104 t.Errorf("diff output = %q", out.String())
105 }
106}
107
108func TestHandleGitDiff_NameOnlyAndStat(t *testing.T) {
109 dir := newGitRepo(t)

Callers

nothing calls this directly

Calls 5

newGitRepoFunction · 0.85
newGitTestEngineFunction · 0.85
ErrorfMethod · 0.80
ExecuteMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected