Skip to content

Commit 9bc8e71

Browse files
committed
wip
1 parent 7cf6130 commit 9bc8e71

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/System.CommandLine.Tests/ArgumentTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,24 @@ public void When_argument_cannot_be_parsed_as_the_specified_type_then_getting_va
443443
.Be("'not-an-int' is not an integer");
444444
}
445445

446+
[Fact]
447+
public void Parse_delegate_is_called_once_per_parse_operation()
448+
{
449+
var i = 0;
450+
451+
var command = new RootCommand
452+
{
453+
new Option<int>(
454+
"-x",
455+
result => ++i,
456+
isDefault: true)
457+
};
458+
459+
command.Parse("");
460+
command.Parse("");
461+
462+
i.Should().Be(2);
463+
}
446464
}
447465

448466
protected override Symbol CreateSymbol(string name)

0 commit comments

Comments
 (0)