-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ability to specify order of positional parameters to be differe…
…nt from declaration. * Change two instances of InternalErrorException to a specialized exception (UnsupportedTypeException and InvalidOrderOfPositionalParametersException).
- Loading branch information
Showing
6 changed files
with
143 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace RT.CommandLine.Tests; | ||
|
||
#pragma warning disable CS0649 // Field is never assigned to and will always have its default value | ||
|
||
class Test4Cmd1 | ||
{ | ||
// Expected order: one, two, three | ||
[IsPositional, IsMandatory] public int One; | ||
[IsPositional, IsMandatory] public int Two; | ||
[IsPositional, IsMandatory] public int Three; | ||
} | ||
|
||
class Test4Cmd2 | ||
{ | ||
// Expected order: three, one, two | ||
[IsPositional(1), IsMandatory] public int One; | ||
[IsPositional(1), IsMandatory] public int Two; | ||
[IsPositional(0), IsMandatory] public int Three; | ||
} | ||
|
||
class Test4Cmd3 | ||
{ | ||
// Expected order: two, one, three | ||
[IsPositional(1), IsMandatory] public int One; | ||
[IsPositional(0), IsMandatory] public int Two; | ||
[IsPositional(1), IsMandatory] public int Three; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace RT.CommandLine.Tests; | ||
|
||
#pragma warning disable CS0649 // Field is never assigned to and will always have its default value | ||
|
||
class Test5Cmd1 | ||
{ | ||
// Mandatory before optional should be allowed | ||
[IsPositional(1)] public int One = 47; | ||
[IsPositional(0), IsMandatory] public int Two; | ||
} | ||
|
||
class Test5Cmd2 | ||
{ | ||
// Optional before mandatory should trigger an error | ||
[IsPositional(1), IsMandatory] public int One; | ||
[IsPositional(0)] public int Two; | ||
} |