(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestManager_Dispatch_binary(t *testing.T) { |
| 177 | dataDir := t.TempDir() |
| 178 | updateDir := t.TempDir() |
| 179 | extPath := filepath.Join(dataDir, "extensions", "gh-hello") |
| 180 | exePath := filepath.Join(extPath, "gh-hello") |
| 181 | bm := binManifest{ |
| 182 | Owner: "owner", |
| 183 | Name: "gh-hello", |
| 184 | Host: "github.com", |
| 185 | Tag: "v1.0.0", |
| 186 | } |
| 187 | assert.NoError(t, stubBinaryExtension(extPath, bm)) |
| 188 | |
| 189 | m := newTestManager(dataDir, updateDir, nil, nil, nil) |
| 190 | |
| 191 | stdout := &bytes.Buffer{} |
| 192 | stderr := &bytes.Buffer{} |
| 193 | found, err := m.Dispatch([]string{"hello", "one", "two"}, nil, stdout, stderr) |
| 194 | assert.NoError(t, err) |
| 195 | assert.True(t, found) |
| 196 | |
| 197 | assert.Equal(t, fmt.Sprintf("[%s one two]\n", exePath), stdout.String()) |
| 198 | assert.Equal(t, "", stderr.String()) |
| 199 | } |
| 200 | |
| 201 | func TestManager_Dispatch_ghExtensionEnv(t *testing.T) { |
| 202 | tests := []struct { |
nothing calls this directly
no test coverage detected