mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-05 03:58:16 +08:00
Pipe character for listing options - Fully implemented and tested.
This commit is contained in:

committed by
Patrik Svensson

parent
e66d3aab2e
commit
43f9ae92ad
@ -23,14 +23,16 @@ public sealed partial class CommandOptionAttributeTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("<VALUE>")]
|
||||
public void Should_Parse_Value_Correctly(string value)
|
||||
[InlineData("<VALUE>", "VALUE")]
|
||||
[InlineData("<VALUE1>", "VALUE1")]
|
||||
[InlineData("<VALUE1|VALUE2>", "VALUE1|VALUE2")]
|
||||
public void Should_Parse_Value_Correctly(string value, string expected)
|
||||
{
|
||||
// Given, When
|
||||
var option = new CommandOptionAttribute($"-o|--option {value}");
|
||||
|
||||
// Then
|
||||
option.ValueName.ShouldBe("VALUE");
|
||||
option.ValueName.ShouldBe(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -28,6 +28,27 @@ public sealed partial class CommandAppTests
|
||||
return Verifier.Verify(result.Output);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Expectation("Root_Command")]
|
||||
public Task Should_Output_Root_Command_Correctly()
|
||||
{
|
||||
// Given
|
||||
var fixture = new CommandAppTester();
|
||||
fixture.Configure(configurator =>
|
||||
{
|
||||
configurator.SetApplicationName("myapp");
|
||||
configurator.AddCommand<DogCommand>("dog");
|
||||
configurator.AddCommand<HorseCommand>("horse");
|
||||
configurator.AddCommand<GiraffeCommand>("giraffe");
|
||||
});
|
||||
|
||||
// When
|
||||
var result = fixture.Run("horse", "--help");
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(result.Output);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Expectation("Hidden_Commands")]
|
||||
public Task Should_Skip_Hidden_Commands()
|
||||
|
Reference in New Issue
Block a user