MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestRunner_Stream

Function TestRunner_Stream

internal/gitcmd/runner_test.go:108–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestRunner_Stream(t *testing.T) {
109 dir := initRepo(t)
110 r := New(2)
111
112 var content string
113 err := r.Stream(context.Background(), dir, func(stdout io.Reader) error {
114 data, err := io.ReadAll(stdout)
115 if err != nil {
116 return err
117 }
118 content = string(data)
119 return nil
120 }, "show", "HEAD:hello.txt")
121 if err != nil {
122 t.Fatalf("Stream error: %v", err)
123 }
124 if content != "hello\n" {
125 t.Errorf("Stream content = %q, want %q", content, "hello\n")
126 }
127}
128
129func TestRunner_ContextCancelled(t *testing.T) {
130 r := New(1)

Callers

nothing calls this directly

Calls 3

initRepoFunction · 0.85
StreamMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected