public void ParseDirective_OutputsResults() { var result = new AppRunner <App>() .UseParseDirective() .Configure(c => c.UseTokenTransformation("test", 1, (ctx, tokens) => new TokenCollection(tokens.Select(t => t.TokenType == TokenType.Value && t.Value != "Do" ? Tokenizer.TokenizeValue("roses") : t)))) .RunInMem("[parse] Do --opt1 smells like".SplitArgs(), _output); result.OutputShouldBe(@"use [parse:verbose] to see results after each transformation >>> from shell Directive: [parse] Value : Do Option : --opt1 Value : smells Value : like >>> transformed after: test > expand-clubbed-flags > split-option-assignments Directive: [parse] Value : Do Option : --opt1 Value : roses Value : roses"); }
public void BasicHelp_Includes_HelpOption() { var result = new AppRunner <App>(TestAppSettings.BasicHelp.Clone(s => s.Help.PrintHelpOption = true)) .RunInMem("Do -h".SplitArgs(), _testOutputHelper); result.OutputShouldBe(@"Usage: dotnet testhost.dll Do [options] Options: -h | --help Show help information"); }
public void ParseDirective_OutputsResults() { var result = new AppRunner <App>(DirectivesEnabled) .UseArgumentTransform("test", 1, tokens => new Tokens(tokens.Select(t => t.TokenType == TokenType.Argument && t.Value != "Do" ? "roses".Tokenize() : t))) .RunInMem("[parse] Do --opt1 smells like".SplitArgs(), _output); result.OutputShouldBe(@"==> received Do --opt1 smells like ==> transformation: test Do --opt1 roses roses ==> transformation: Expand clubbed flags (no changes)"); }