Browse Source

Document behavior of option case sensitivity

pull/3205/head
Christoph Wille 1 year ago
parent
commit
d8c4c855f5
  1. 20
      ILSpy.Tests/CommandLineArgumentsTests.cs
  2. 3
      ILSpy/CommandLineArguments.cs

20
ILSpy.Tests/CommandLineArgumentsTests.cs

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
using FluentAssertions;
using System;
using FluentAssertions;
using NUnit.Framework;
@ -36,6 +38,22 @@ namespace ICSharpCode.ILSpy.Tests @@ -36,6 +38,22 @@ namespace ICSharpCode.ILSpy.Tests
cmdLineArgs.NavigateTo.Should().BeEquivalentTo(navigateTo);
}
[Test]
public void VerifyNavigateToOption_NoneTest_Matching_VSAddin()
{
var cmdLineArgs = new CommandLineArguments(new string[] { "--navigateto:none" });
cmdLineArgs.NavigateTo.Should().BeEquivalentTo("none");
}
[Test]
public void VerifyCaseSensitivityOfOptionsThrows()
{
Action act = () => new CommandLineArguments(new string[] { "--navigateTo:none" });
act.Should().Throw<McMaster.Extensions.CommandLineUtils.UnrecognizedCommandParsingException>()
.WithMessage("Unrecognized option '--navigateTo:none'");
}
[Test]
public void VerifySearchOption()
{

3
ILSpy/CommandLineArguments.cs

@ -39,6 +39,9 @@ namespace ICSharpCode.ILSpy @@ -39,6 +39,9 @@ namespace ICSharpCode.ILSpy
var app = new CommandLineApplication() {
// https://natemcmaster.github.io/CommandLineUtils/docs/response-file-parsing.html?tabs=using-attributes
ResponseFileHandling = ResponseFileHandling.ParseArgsAsSpaceSeparated,
// Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse()
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
};
var oForceNewInstance = app.Option("--newinstance",

Loading…
Cancel
Save