MCPcopy Create free account
hub / github.com/codnect/procyon / TestArgs_OptionNames

Function TestArgs_OptionNames

runtime/argument_test.go:75–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestArgs_OptionNames(t *testing.T) {
76 testCases := []struct {
77 name string
78 args []string
79 wantOptionNames []string
80 }{
81 {
82 name: "option does not exist",
83 args: []string{"argKey1", "-argKey2", "--argKey3=arg3Val"},
84 wantOptionNames: []string{"argKey3"},
85 },
86 {
87 name: "non-option args",
88 args: []string{"argKey1", "-argKey2"},
89 wantOptionNames: []string{},
90 },
91 }
92
93 for _, tc := range testCases {
94 t.Run(tc.name, func(t *testing.T) {
95 // given
96 args, err := ParseArgs(tc.args)
97 require.NoError(t, err)
98
99 // when
100 optionNames := args.OptionNames()
101
102 // then
103 assert.Equal(t, tc.wantOptionNames, optionNames)
104 })
105 }
106}
107
108func TestArgs_ContainsOption(t *testing.T) {
109 testCases := []struct {

Callers

nothing calls this directly

Calls 3

ParseArgsFunction · 0.85
OptionNamesMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected