(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestFishCompletionShellComplete(t *testing.T) { |
| 45 | cmd := buildExtendedTestCommand() |
| 46 | cmd.ShellComplete = func(context.Context, *Command) {} |
| 47 | |
| 48 | configCmd := cmd.Command("config") |
| 49 | configCmd.ShellComplete = func(context.Context, *Command) {} |
| 50 | |
| 51 | subConfigCmd := configCmd.Command("sub-config") |
| 52 | subConfigCmd.ShellComplete = func(context.Context, *Command) {} |
| 53 | |
| 54 | cmd.setupCommandGraph() |
| 55 | |
| 56 | res, err := cmd.ToFishCompletion() |
| 57 | require.NoError(t, err) |
| 58 | |
| 59 | assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_greet_no_subcommand' -xa '(greet %s 2>/dev/null)'", completionFlag)) |
| 60 | assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_seen_subcommand_from config c' -xa '(greet config %s 2>/dev/null)'", completionFlag)) |
| 61 | assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_seen_subcommand_from config c; and __fish_seen_subcommand_from sub-config s ss' -xa '(greet config sub-config %s 2>/dev/null)'", completionFlag)) |
| 62 | } |
nothing calls this directly
no test coverage detected