| 153 | } |
| 154 | |
| 155 | func TestOptions_AddFlags_Format(t *testing.T) { |
| 156 | t.Parallel() |
| 157 | tests := []struct { |
| 158 | name string |
| 159 | opts *Options |
| 160 | expected []string |
| 161 | }{ |
| 162 | { |
| 163 | name: "default options", |
| 164 | opts: &Options{}, |
| 165 | expected: []string{}, |
| 166 | }, |
| 167 | } |
| 168 | |
| 169 | for _, tt := range tests { |
| 170 | t.Run(tt.name, func(t *testing.T) { |
| 171 | t.Parallel() |
| 172 | cmd := &cobra.Command{} |
| 173 | tt.opts.AddFlags(cmd) |
| 174 | if !cmp.Equal(cmd.Flag(FlagFormat).Value.String(), strings.Join(tt.expected, ", ")) { |
| 175 | t.Errorf("expected FlagFormat to be %q, but got %q", strings.Join(tt.expected, ", "), cmd.Flag(FlagFormat).Value.String()) |
| 176 | } |
| 177 | }) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | func TestOptions_AddFlags_Annotations(t *testing.T) { |
| 182 | t.Parallel() |