@@ -152,6 +152,77 @@ public void Parse_options_with_double_dash_and_option_sequence()
152
152
( ( Parsed < Options_With_Option_Sequence_And_Value_Sequence > ) result ) . Value . Should ( ) . BeEquivalentTo ( expectedOptions ) ;
153
153
}
154
154
155
+ [ Theory ]
156
+ [ InlineData ( "value1" , "value2" , "value3" ) ]
157
+ [ InlineData ( "--" , "value1" , "value2" , "value3" ) ]
158
+ [ InlineData ( "value1" , "--" , "value2" , "value3" ) ]
159
+ [ InlineData ( "value1" , "value2" , "--" , "value3" ) ]
160
+ [ InlineData ( "value1" , "value2" , "value3" , "--" ) ]
161
+ public void Parse_options_with_double_dash_in_various_positions ( params string [ ] args )
162
+ {
163
+ var expectedOptions = new Options_With_Sequence_And_Only_Max_Constraint_For_Value
164
+ {
165
+ StringSequence = new [ ] { "value1" , "value2" , "value3" }
166
+ } ;
167
+
168
+ var sut = new Parser ( with => with . EnableDashDash = true ) ;
169
+
170
+ // Exercize system
171
+ var result =
172
+ sut . ParseArguments < Options_With_Sequence_And_Only_Max_Constraint_For_Value > ( args ) ;
173
+
174
+ // Verify outcome
175
+ ( ( Parsed < Options_With_Sequence_And_Only_Max_Constraint_For_Value > ) result ) . Value . Should ( ) . BeEquivalentTo ( expectedOptions ) ;
176
+ }
177
+
178
+ [ Theory ]
179
+ [ InlineData ( "value1" , "value2" , "value3" ) ]
180
+ [ InlineData ( "--" , "value1" , "value2" , "value3" ) ]
181
+ [ InlineData ( "value1" , "--" , "value2" , "value3" ) ]
182
+ [ InlineData ( "value1" , "value2" , "--" , "value3" ) ]
183
+ [ InlineData ( "value1" , "value2" , "value3" , "--" ) ]
184
+ public void Parse_options_with_double_dash_and_all_consuming_sequence_leaves_nothing_for_later_values ( params string [ ] args )
185
+ {
186
+ var expectedOptions = new Options_With_Value_Sequence_And_Subsequent_Value
187
+ {
188
+ StringSequence = new [ ] { "value1" , "value2" , "value3" } ,
189
+ NeverReachedValue = null
190
+ } ;
191
+
192
+ var sut = new Parser ( with => with . EnableDashDash = true ) ;
193
+
194
+ // Exercize system
195
+ var result =
196
+ sut . ParseArguments < Options_With_Value_Sequence_And_Subsequent_Value > ( args ) ;
197
+
198
+ // Verify outcome
199
+ ( ( Parsed < Options_With_Value_Sequence_And_Subsequent_Value > ) result ) . Value . Should ( ) . BeEquivalentTo ( expectedOptions ) ;
200
+ }
201
+
202
+ [ Theory ]
203
+ [ InlineData ( "value1" , "value2" , "value3" ) ]
204
+ [ InlineData ( "--" , "value1" , "value2" , "value3" ) ]
205
+ [ InlineData ( "value1" , "--" , "value2" , "value3" ) ]
206
+ [ InlineData ( "value1" , "value2" , "--" , "value3" ) ]
207
+ [ InlineData ( "value1" , "value2" , "value3" , "--" ) ]
208
+ public void Parse_options_with_double_dash_and_limited_sequence_leaves_something_for_later_values ( params string [ ] args )
209
+ {
210
+ var expectedOptions = new Options_With_Value_Sequence_With_Max_And_Subsequent_Value
211
+ {
212
+ StringSequence = new [ ] { "value1" , "value2" } ,
213
+ NeverReachedValue = "value3"
214
+ } ;
215
+
216
+ var sut = new Parser ( with => with . EnableDashDash = true ) ;
217
+
218
+ // Exercize system
219
+ var result =
220
+ sut . ParseArguments < Options_With_Value_Sequence_With_Max_And_Subsequent_Value > ( args ) ;
221
+
222
+ // Verify outcome
223
+ ( ( Parsed < Options_With_Value_Sequence_With_Max_And_Subsequent_Value > ) result ) . Value . Should ( ) . BeEquivalentTo ( expectedOptions ) ;
224
+ }
225
+
155
226
[ Fact ]
156
227
public void Parse_options_with_double_dash_in_verbs_scenario ( )
157
228
{
0 commit comments