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

Function TestRunner_Stream

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

Source from the content-addressed store, hash-verified

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