(t *testing.T)
| 257 | } |
| 258 | |
| 259 | func TestCompleteAliasIncludesYAMLFiles(t *testing.T) { |
| 260 | // This test changes the working directory so it cannot run in parallel |
| 261 | |
| 262 | // Create temp directory with YAML files |
| 263 | tmpDir := t.TempDir() |
| 264 | writeFile(t, tmpDir, "golang_developer.yaml") |
| 265 | writeFile(t, tmpDir, "gopher.yaml") |
| 266 | writeFile(t, tmpDir, "other.yaml") |
| 267 | writeFile(t, tmpDir, "readme.md") // not a yaml file |
| 268 | |
| 269 | // Change working directory |
| 270 | t.Chdir(tmpDir) |
| 271 | |
| 272 | // Test that completeAlias includes YAML files starting with "go" |
| 273 | completions, directive := completeAlias("go") |
| 274 | |
| 275 | // Should include yaml files matching "go" prefix |
| 276 | assert.Contains(t, completions, "golang_developer.yaml") |
| 277 | assert.Contains(t, completions, "gopher.yaml") |
| 278 | assert.NotContains(t, completions, "other.yaml") // doesn't match prefix |
| 279 | assert.NotContains(t, completions, "readme.md") // not a yaml file |
| 280 | |
| 281 | // Should set NoFileComp |
| 282 | assert.NotEqual(t, cobra.ShellCompDirective(0), directive&cobra.ShellCompDirectiveNoFileComp, |
| 283 | "expected NoFileComp directive to be set") |
| 284 | } |
| 285 | |
| 286 | func TestCompleteRunExec(t *testing.T) { |
| 287 | t.Parallel() |
nothing calls this directly
no test coverage detected