MCPcopy Create free account
hub / github.com/github/gh-aw / TestUninstallBashCompletion

Function TestUninstallBashCompletion

pkg/cli/shell_completion_test.go:193–220  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

191}
192
193func TestUninstallBashCompletion(t *testing.T) {
194 // Create a temporary home directory
195 tmpDir := t.TempDir()
196 originalHome := os.Getenv("HOME")
197 defer os.Setenv("HOME", originalHome)
198 os.Setenv("HOME", tmpDir)
199
200 // Create completion directory and file
201 completionDir := tmpDir + "/.bash_completion.d"
202 err := os.MkdirAll(completionDir, 0750)
203 require.NoError(t, err)
204
205 completionFile := completionDir + "/gh-aw"
206 err = os.WriteFile(completionFile, []byte("# test completion"), 0600)
207 require.NoError(t, err)
208
209 // Verify file exists before uninstall
210 _, err = os.Stat(completionFile)
211 require.NoError(t, err)
212
213 // Uninstall
214 err = uninstallBashCompletion(false)
215 require.NoError(t, err)
216
217 // Verify file is removed
218 _, err = os.Stat(completionFile)
219 assert.True(t, os.IsNotExist(err), "Completion file should be removed")
220}
221
222func TestUninstallBashCompletionNotFound(t *testing.T) {
223 // Create a temporary home directory without completion file

Callers

nothing calls this directly

Calls 3

uninstallBashCompletionFunction · 0.85
GetenvMethod · 0.80
SetenvMethod · 0.80

Tested by

no test coverage detected