MCPcopy
hub / github.com/cli/cli / TestManager_Dispatch_binary

Function TestManager_Dispatch_binary

pkg/cmd/extension/manager_test.go:169–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestManager_Dispatch_binary(t *testing.T) {
170 dataDir := t.TempDir()
171 updateDir := t.TempDir()
172 extPath := filepath.Join(dataDir, "extensions", "gh-hello")
173 exePath := filepath.Join(extPath, "gh-hello")
174 bm := binManifest{
175 Owner: "owner",
176 Name: "gh-hello",
177 Host: "github.com",
178 Tag: "v1.0.0",
179 }
180 assert.NoError(t, stubBinaryExtension(extPath, bm))
181
182 m := newTestManager(dataDir, updateDir, nil, nil, nil)
183
184 stdout := &bytes.Buffer{}
185 stderr := &bytes.Buffer{}
186 found, err := m.Dispatch([]string{"hello", "one", "two"}, nil, stdout, stderr)
187 assert.NoError(t, err)
188 assert.True(t, found)
189
190 assert.Equal(t, fmt.Sprintf("[%s one two]\n", exePath), stdout.String())
191 assert.Equal(t, "", stderr.String())
192}
193
194func TestManager_Remove(t *testing.T) {
195 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 6

stubBinaryExtensionFunction · 0.85
newTestManagerFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
DispatchMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected