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

Function TestUninstallFishCompletion

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

Source from the content-addressed store, hash-verified

275}
276
277func TestUninstallFishCompletion(t *testing.T) {
278 // Create a temporary home directory
279 tmpDir := t.TempDir()
280 originalHome := os.Getenv("HOME")
281 defer os.Setenv("HOME", originalHome)
282 os.Setenv("HOME", tmpDir)
283
284 // Create completion directory and file
285 completionDir := tmpDir + "/.config/fish/completions"
286 err := os.MkdirAll(completionDir, 0750)
287 require.NoError(t, err)
288
289 completionFile := completionDir + "/gh-aw.fish"
290 err = os.WriteFile(completionFile, []byte("# test completion"), 0600)
291 require.NoError(t, err)
292
293 // Verify file exists before uninstall
294 _, err = os.Stat(completionFile)
295 require.NoError(t, err)
296
297 // Uninstall
298 err = uninstallFishCompletion(false)
299 require.NoError(t, err)
300
301 // Verify file is removed
302 _, err = os.Stat(completionFile)
303 assert.True(t, os.IsNotExist(err), "Completion file should be removed")
304}
305
306func TestUninstallFishCompletionNotFound(t *testing.T) {
307 // Create a temporary home directory without completion file

Callers

nothing calls this directly

Calls 3

uninstallFishCompletionFunction · 0.85
GetenvMethod · 0.80
SetenvMethod · 0.80

Tested by

no test coverage detected