-
Notifications
You must be signed in to change notification settings - Fork 291
/
Copy pathParserTests.cs
649 lines (550 loc) · 26.5 KB
/
ParserTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using CommandLine.Tests.Fakes;
using FluentAssertions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;
namespace CommandLine.Tests.Unit
{
public class ParserTests
{
[Fact]
public void When_HelpWriter_is_set_help_screen_is_generated()
{
// Fixture setup
var writer = new StringWriter();
var sut = new Parser(with => with.HelpWriter = writer);
// Exercize system
sut.ParseArguments<Options_With_Required_Set_To_True>(new string[] { });
// Verify outcome
var text = writer.ToString();
Assert.True(text.Length > 0);
// Teardown
}
[Fact]
public void When_HelpWriter_is_set_help_screen_is_generated_in_verbs_scenario()
{
// Fixture setup
var writer = new StringWriter();
var sut = new Parser(with => with.HelpWriter = writer);
// Exercize system
sut.ParseArguments(new string[] { }, typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb));
// Verify outcome
var text = writer.ToString();
text.Should().NotBeEmpty();
// Teardown
}
[Fact]
public void When_HelpWriter_is_set_help_screen_is_generated_in_verbs_scenario_using_generic_overload()
{
// Fixture setup
var writer = new StringWriter();
var sut = new Parser(with => with.HelpWriter = writer);
// Exercize system
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(new string[] { });
// Verify outcome
var text = writer.ToString();
text.Should().NotBeEmpty();
// Teardown
}
[Fact]
public void Parse_options()
{
// Fixture setup
var expectedOptions = new Simple_Options { StringValue = "strvalue", IntSequence = new[] { 1, 2, 3 } };
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Simple_Options>(new[] { "--stringvalue=strvalue", "-i1", "2", "3" });
// Verify outcome
((Parsed<Simple_Options>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Theory]
[InlineData("file", new[] { "-o", "file" })]
[InlineData("file", new[] { "-ofile" })]
[InlineData("hile", new[] { "-o", "hile" })]
[InlineData("hile", new[] { "-ohile" })]
public void Parse_options_with_short_name(string outputFile, string[] args)
{
// Fixture setup
var expectedOptions = new Options_With_Switches { OutputFile = outputFile };
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Options_With_Switches>(args);
// Verify outcome
((Parsed<Options_With_Switches>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
public void Parse_repeated_options_with_default_parser()
{
// Fixture setup
var sut = Parser.Default;
// Exercize system
var result = sut.ParseArguments<Options_With_Switches>(new[] { "-i", "-i", "-o", "file" });
// Verify outcome
Assert.IsType<NotParsed<Options_With_Switches>>(result);
// Teardown
}
[Fact]
public void Parse_options_with_double_dash()
{
// Fixture setup
var expectedOptions = new Simple_Options_With_Values
{
StringValue = "astring",
LongValue = 20L,
StringSequence = new[] { "--aaa", "-b", "--ccc" },
IntValue = 30
};
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result =
sut.ParseArguments<Simple_Options_With_Values>(
new[] { "--stringvalue", "astring", "--", "20", "--aaa", "-b", "--ccc", "30" });
// Verify outcome
((Parsed<Simple_Options_With_Values>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
[Trait("windows-style-options", "stock long and short names only")]
public void Parse_options_with_win_style_enabled()
{
// Fixture setup
var expectedOptions = new Simple_Options_With_Values
{
StringValue = "astring",
LongValue = 20L,
StringSequence = new[] { "--aaa", "-b", "--ccc" },
IntValue = 30
};
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result =
sut.ParseArguments<Simple_Options_With_Values>(
new[] { "--stringvalue", "astring", "--", "20", "--aaa", "-b", "--ccc", "30" }, true);
// Verify outcome
((Parsed<Simple_Options_With_Values>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
[Trait("windows-style-options", "windows long names and stock short names")]
public void Parse_options_with_win_style_enabled_2()
{
// Fixture setup
var expectedOptions = new Simple_Options_With_Values
{
StringValue = "astring",
LongValue = 20L,
StringSequence = new[] { "--aaa", "-b", "--ccc" },
IntValue = 30
};
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result =
sut.ParseArguments<Simple_Options_With_Values>(
new[] { "/stringvalue", "astring", "/", "20", "/aaa", "-b", "/ccc", "30" }, true);
// Verify outcome
((Parsed<Simple_Options_With_Values>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
[Trait("windows-style-options", "mixed long names and stock short names")]
public void Parse_options_with_mixed_option_longName_styles()
{
// Fixture setup
var expectedOptions = new Simple_Options_With_Values
{
StringValue = "astring",
LongValue = 20L,
StringSequence = new[] { "--aaa", "-b", "--ccc" },
IntValue = 30
};
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result =
sut.ParseArguments<Simple_Options_With_Values>(
new[] { "--stringvalue", "astring", "/", "20", "--aaa", "-b", "/ccc", "30" }, true);
// Verify outcome
((Parsed<Simple_Options_With_Values>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
[Trait("windows-style-options", "single verb without options")]
public void Parse_options_with_win_style_in_verbs_scenario()
{
// Fixture setup
var expectedOptions = new Add_Verb { Patch = true, FileName = "--strange-fn" };
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result = sut.ParseArguments(
new[] { "add", "-p", "/", "/strange-fn" },
new List<Type>
{
typeof(Add_Verb),
typeof(Commit_Verb),
typeof(Clone_Verb)
}, useWinStyleOptions: true);
// Verify outcome
Assert.IsType<Add_Verb>(((Parsed<object>)result).Value);
((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
// Teardown
}
[Fact]
public void Parse_options_with_double_dash_in_verbs_scenario()
{
// Fixture setup
var expectedOptions = new Add_Verb { Patch = true, FileName = "--strange-fn" };
var sut = new Parser(with => with.EnableDashDash = true);
// Exercize system
var result = sut.ParseArguments(
new[] { "add", "-p", "--", "--strange-fn" },
typeof(Add_Verb),
typeof(Commit_Verb),
typeof(Clone_Verb));
// Verify outcome
Assert.IsType<Add_Verb>(((Parsed<object>)result).Value);
((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
// Teardown
}
[Fact]
public void Parse_verbs()
{
// Fixture setup
var expectedOptions = new Clone_Verb
{
Quiet = true,
Urls =
new[]
{
"http://gsscoder.github.com/",
"http://yes-to-nooo.github.com/"
}
};
var sut = new Parser();
// Exercize system
var result =
sut.ParseArguments(
new[] { "clone", "-q", "http://gsscoder.github.com/", "http://yes-to-nooo.github.com/" },
typeof(Add_Verb),
typeof(Commit_Verb),
typeof(Clone_Verb));
// Verify outcome
Assert.IsType<Clone_Verb>(((Parsed<object>)result).Value);
((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
// Teardown
}
[Theory]
[InlineData("blabla", new[] { "commit", "-m", "blabla" })]
[InlineData("blabla", new[] { "commit", "-mblabla" })]
[InlineData("plapla", new[] { "commit", "-m", "plapla" })]
[InlineData("plapla", new[] { "commit", "-mplapla" })]
public void Parse_options_with_short_name_in_verbs_scenario(string message, string[] args)
{
// Fixture setup
var expectedOptions = new Commit_Verb() { Message = message };
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments(
args,
typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb));
// Verify outcome
Assert.IsType<Commit_Verb>(((Parsed<object>)result).Value);
((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
// Teardown
}
[Fact]
public void Parse_repeated_options_with_default_parser_in_verbs_scenario()
{
// Fixture setup
var sut = Parser.Default;
// Exercize system
var result = sut.ParseArguments(
new[] { "clone", "-q", "-q", "http://gsscoder.github.com/", "http://yes-to-nooo.github.com/" },
typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb));
// Verify outcome
Assert.IsType<NotParsed<object>>(result);
// Teardown
}
[Fact]
public void Parse_verbs_using_generic_overload()
{
// Fixture setup
var expectedOptions = new Clone_Verb
{
Quiet = true,
Urls =
new[]
{
"http://gsscoder.github.com/",
"http://yes-to-nooo.github.com/"
}
};
var sut = new Parser();
// Exercize system
var result =
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(
new[] { "clone", "-q", "http://gsscoder.github.com/", "http://yes-to-nooo.github.com/" });
// Verify outcome
Assert.IsType<Clone_Verb>(((Parsed<object>)result).Value);
((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
// Teardown
}
[Fact]
public void Parse_to_immutable_instance()
{
// Fixture setup
var expectedOptions = new Immutable_Simple_Options("strvalue", new[] { 1, 2, 3 }, default(bool), default(long));
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Immutable_Simple_Options>(new[] { "--stringvalue=strvalue", "-i1", "2", "3" });
// Verify outcome
((Parsed<Immutable_Simple_Options>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
[Trait("windows-style-options", "parse to immutable instance")]
public void Parse_to_immutable_instance_winstyle_option()
{
// Fixture setup
var expectedOptions = new Immutable_Simple_Options("strvalue", new[] { 1, 2, 3 }, default(bool), default(long));
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Immutable_Simple_Options>(new[] { "/stringvalue=strvalue", "-i1", "2", "3" }
, useWinStyleOptions: true);
// Verify outcome
((Parsed<Immutable_Simple_Options>)result).Value.ShouldBeEquivalentTo(expectedOptions);
// Teardown
}
[Fact]
public void Explicit_help_request_with_immutable_instance_generates_help_requested_error()
{
// Fixture setup
var expectedError = new HelpRequestedError();
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Immutable_Simple_Options>(new[] { "--help" });
// Verify outcome
((NotParsed<Immutable_Simple_Options>)result).Errors.Should().HaveCount(x => x == 1);
((NotParsed<Immutable_Simple_Options>)result).Errors.Should().ContainSingle(e => e.Equals(expectedError));
// Teardown
}
[Fact]
public void Explicit_help_request_with_immutable_instance_generates_help_screen()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Immutable_Simple_Options>(new[] { "--help" });
var result = help.ToString();
// Verify outcome
result.Length.Should().BeGreaterThan(0);
// Teardown
}
[Fact]
public void Explicit_version_request_generates_version_requested_error()
{
// Fixture setup
var expectedError = new VersionRequestedError();
var sut = new Parser();
// Exercize system
var result = sut.ParseArguments<Simple_Options>(new[] { "--version" });
// Verify outcome
((NotParsed<Simple_Options>)result).Errors.Should().HaveCount(x => x == 1);
((NotParsed<Simple_Options>)result).Errors.Should().ContainSingle(e => e.Equals(expectedError));
// Teardown
}
[Fact]
public void Explicit_version_request_generates_version_info_screen()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Simple_Options>(new[] { "--version" });
var result = help.ToString();
// Verify outcome
result.Length.Should().BeGreaterThan(0);
var lines = result.ToNotEmptyLines().TrimStringArray();
lines.Should().HaveCount(x => x == 1);
lines[0].Should().StartWithEquivalent("CommandLine");
// Teardown
}
[Fact]
public void Implicit_help_screen_in_verb_scenario()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(new string[] { });
var result = help.ToString();
// Verify outcome
result.Length.Should().BeGreaterThan(0);
var lines = result.ToNotEmptyLines().TrimStringArray();
lines[0].Should().StartWithEquivalent("CommandLine");
lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala");
lines[2].ShouldBeEquivalentTo("ERROR(S):");
lines[3].ShouldBeEquivalentTo("No verb selected.");
lines[4].ShouldBeEquivalentTo("add Add file contents to the index.");
lines[5].ShouldBeEquivalentTo("commit Record changes to the repository.");
lines[6].ShouldBeEquivalentTo("clone Clone a repository into a new directory.");
lines[7].ShouldBeEquivalentTo("help Display more information on a specific command.");
lines[8].ShouldBeEquivalentTo("version Display version information.");
// Teardown
}
[Fact]
public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(new[] { "--help" });
var result = help.ToString();
// Verify outcome
var lines = result.ToNotEmptyLines().TrimStringArray();
lines[0].Should().StartWithEquivalent("CommandLine");
lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala");
lines[2].ShouldBeEquivalentTo("add Add file contents to the index.");
lines[3].ShouldBeEquivalentTo("commit Record changes to the repository.");
lines[4].ShouldBeEquivalentTo("clone Clone a repository into a new directory.");
lines[5].ShouldBeEquivalentTo("help Display more information on a specific command.");
lines[6].ShouldBeEquivalentTo("version Display version information.");
// Teardown
}
[Theory]
[InlineData("--version")]
[InlineData("version")]
public void Explicit_version_request_generates_version_info_screen_in_verbs_scenario(string command)
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(new[] { command });
var result = help.ToString();
// Verify outcome
result.Length.Should().BeGreaterThan(0);
var lines = result.ToNotEmptyLines().TrimStringArray();
lines.Should().HaveCount(x => x == 1);
lines[0].Should().StartWithEquivalent("CommandLine");
// Teardown
}
[Fact]
public void Errors_of_type_MutuallyExclusiveSetError_are_properly_formatted()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Options_With_Two_Option_Required_Set_To_True_And_Two_Sets>(new[] { "--weburl=value.com", "--ftpurl=value.org" });
var result = help.ToString();
// Verify outcome
var lines = result.ToNotEmptyLines().TrimStringArray();
lines[0].Should().StartWithEquivalent("CommandLine");
lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala");
lines[2].ShouldBeEquivalentTo("ERROR(S):");
lines[3].ShouldBeEquivalentTo("Option: 'weburl' is not compatible with: 'ftpurl'.");
lines[4].ShouldBeEquivalentTo("Option: 'ftpurl' is not compatible with: 'weburl'.");
lines[5].ShouldBeEquivalentTo("--weburl Required.");
lines[6].ShouldBeEquivalentTo("--ftpurl Required.");
lines[7].ShouldBeEquivalentTo("-a");
lines[8].ShouldBeEquivalentTo("--help Display this help screen.");
lines[9].ShouldBeEquivalentTo("--version Display version information.");
// Teardown
}
[Fact]
public void Explicit_help_request_with_specific_verb_generates_help_screen()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(new[] { "commit", "--help" });
var result = help.ToString();
// Verify outcome
result.Length.Should().BeGreaterThan(0);
// Teardown
}
[Fact]
public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in_verb_scenario()
{
// Fixture setup
var help = new StringWriter();
var sut = new Parser(config => config.HelpWriter = help);
// Exercize system
sut.ParseArguments<Add_Verb_With_Usage_Attribute, Commit_Verb_With_Usage_Attribute, Clone_Verb_With_Usage_Attribute>(
new[] { "clone", "--badoption=@bad?value" });
var result = help.ToString();
// Verify outcome
var lines = result.ToNotEmptyLines().TrimStringArray();
lines[0].Should().StartWithEquivalent("CommandLine");
lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala");
lines[2].ShouldBeEquivalentTo("ERROR(S):");
lines[3].ShouldBeEquivalentTo("Option 'badoption' is unknown.");
lines[4].ShouldBeEquivalentTo("USAGE:");
lines[5].ShouldBeEquivalentTo("Cloning quietly:");
lines[6].ShouldBeEquivalentTo("git clone --quiet https://github.com/gsscoder/railwaysharp");
lines[7].ShouldBeEquivalentTo("Cloning without hard links:");
lines[8].ShouldBeEquivalentTo("git clone --no-hardlinks https://github.com/gsscoder/csharpx");
lines[9].ShouldBeEquivalentTo("--no-hardlinks Optimize the cloning process from a repository on a local");
lines[10].ShouldBeEquivalentTo("filesystem by copying files.");
lines[11].ShouldBeEquivalentTo("-q, --quiet Suppress summary message.");
lines[12].ShouldBeEquivalentTo("--help Display this help screen.");
lines[13].ShouldBeEquivalentTo("--version Display version information.");
lines[14].ShouldBeEquivalentTo("URLS (pos. 0) A list of url(s) to clone.");
// Teardown
}
[Theory]
[MemberData("IgnoreUnknownArgumentsData")]
public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_failure_parsing(
string[] arguments,
Simple_Options expected)
{
// Fixture setup
var sut = new Parser(config => config.IgnoreUnknownArguments = true);
// Exercize system
var result = sut.ParseArguments<Simple_Options>(arguments);
// Verify outcome
result.Tag.ShouldBeEquivalentTo(ParserResultType.Parsed);
result.WithParsed(opts => opts.ShouldBeEquivalentTo(expected));
// Teardown
}
[Theory]
[MemberData("IgnoreUnknownArgumentsForVerbsData")]
public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_failure_parsing_for_verbs(
string[] arguments,
Commit_Verb expected)
{
// Fixture setup
var sut = new Parser(config => config.IgnoreUnknownArguments = true);
// Exercize system
var result = sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(arguments);
// Verify outcome
result.Tag.ShouldBeEquivalentTo(ParserResultType.Parsed);
result.WithParsed(opts => opts.ShouldBeEquivalentTo(expected));
// Teardown
}
public static IEnumerable<object> IgnoreUnknownArgumentsData
{
get
{
yield return new object[] { new[] { "--stringvalue=strdata0", "--unknown=valid" }, new Simple_Options { StringValue = "strdata0", IntSequence = Enumerable.Empty<int>() } };
yield return new object[] { new[] { "--stringvalue=strdata0", "1234", "--unknown", "-i", "1", "2", "3" }, new Simple_Options { StringValue = "strdata0", LongValue = 1234L, IntSequence = new[] { 1, 2, 3 } } };
yield return new object[] { new[] { "--stringvalue=strdata0", "-u" }, new Simple_Options { StringValue = "strdata0", IntSequence = Enumerable.Empty<int>() } };
}
}
public static IEnumerable<object> IgnoreUnknownArgumentsForVerbsData
{
get
{
yield return new object[] { new[] { "commit", "-up" }, new Commit_Verb { Patch = true } };
yield return new object[] { new[] { "commit", "--amend", "--unknown", "valid" }, new Commit_Verb { Amend = true } };
}
}
}
}