@@ -75,6 +75,20 @@ func TestParseFlags(t *testing.T) {
7575 require .Equal (t , "medium" , opts .Effort )
7676 },
7777 },
78+ {
79+ name : "valid effort low" ,
80+ args : []string {"--effort" , "low" },
81+ validate : func (t * testing.T , opts * PromptPexOptions ) {
82+ require .Equal (t , "low" , opts .Effort )
83+ },
84+ },
85+ {
86+ name : "valid effort high" ,
87+ args : []string {"--effort" , "high" },
88+ validate : func (t * testing.T , opts * PromptPexOptions ) {
89+ require .Equal (t , "high" , opts .Effort )
90+ },
91+ },
7892 {
7993 name : "groundtruth model flag" ,
8094 args : []string {"--groundtruth-model" , "openai/gpt-4o" },
@@ -157,6 +171,63 @@ func TestParseFlags(t *testing.T) {
157171 }
158172}
159173
174+ func TestParseFlagsInvalidEffort (t * testing.T ) {
175+ tests := []struct {
176+ name string
177+ effort string
178+ expectedErr string
179+ }{
180+ {
181+ name : "invalid effort value" ,
182+ effort : "invalid" ,
183+ expectedErr : "invalid effort level 'invalid': must be one of low, medium, or high" ,
184+ },
185+ {
186+ name : "empty effort value" ,
187+ effort : "" ,
188+ expectedErr : "" , // Empty should be allowed (no error)
189+ },
190+ {
191+ name : "case sensitive effort" ,
192+ effort : "Low" ,
193+ expectedErr : "invalid effort level 'Low': must be one of low, medium, or high" ,
194+ },
195+ {
196+ name : "numeric effort" ,
197+ effort : "1" ,
198+ expectedErr : "invalid effort level '1': must be one of low, medium, or high" ,
199+ },
200+ }
201+
202+ for _ , tt := range tests {
203+ t .Run (tt .name , func (t * testing.T ) {
204+ // Create a temporary command to parse flags
205+ cmd := NewGenerateCommand (nil )
206+ args := []string {}
207+ if tt .effort != "" {
208+ args = append (args , "--effort" , tt .effort )
209+ }
210+ args = append (args , "dummy.yml" ) // Add required positional arg
211+ cmd .SetArgs (args )
212+
213+ // Parse flags but don't execute
214+ err := cmd .ParseFlags (args [:len (args )- 1 ]) // Exclude positional arg from flag parsing
215+ require .NoError (t , err )
216+
217+ // Parse options from the flags
218+ options := GetDefaultOptions ()
219+ err = ParseFlags (cmd , options )
220+
221+ if tt .expectedErr == "" {
222+ require .NoError (t , err )
223+ } else {
224+ require .Error (t , err )
225+ require .Contains (t , err .Error (), tt .expectedErr )
226+ }
227+ })
228+ }
229+ }
230+
160231func TestGenerateCommandExecution (t * testing.T ) {
161232
162233 t .Run ("fails with invalid prompt file" , func (t * testing.T ) {
0 commit comments