MCPcopy
hub / github.com/ossf/scorecard / TestOptions_AddFlags_Format

Function TestOptions_AddFlags_Format

options/flags_test.go:155–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

153}
154
155func 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
181func TestOptions_AddFlags_Annotations(t *testing.T) {
182 t.Parallel()

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
AddFlagsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected