(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestCompleteSessionIDs(t *testing.T) { |
| 68 | t.Run("with args returns no completions", func(t *testing.T) { |
| 69 | cmd := &cobra.Command{Use: "x"} |
| 70 | comps, directive := completeSessionIDs(cmd, []string{"already"}, "") |
| 71 | if comps != nil { |
| 72 | t.Errorf("expected nil completions, got %v", comps) |
| 73 | } |
| 74 | if directive != cobra.ShellCompDirectiveNoFileComp { |
| 75 | t.Errorf("directive = %v, want NoFileComp", directive) |
| 76 | } |
| 77 | }) |
| 78 | |
| 79 | t.Run("fresh repo yields empty completions", func(t *testing.T) { |
| 80 | dir := initTestGitRepo(t) |
| 81 | cmd := &cobra.Command{Use: "x"} |
| 82 | cmd.Flags().String("repo", dir, "") |
| 83 | comps, directive := completeSessionIDs(cmd, nil, "") |
| 84 | if len(comps) != 0 { |
| 85 | t.Errorf("expected no completions for fresh repo, got %v", comps) |
| 86 | } |
| 87 | if directive != cobra.ShellCompDirectiveNoFileComp { |
| 88 | t.Errorf("directive = %v, want NoFileComp", directive) |
| 89 | } |
| 90 | }) |
| 91 | } |
nothing calls this directly
no test coverage detected