Removed the old command line parser since its replacement is fully functional by now; the CommandLine class now provides a HasArgument() method for convenience; added experimental parsing for pre-split command lines (as provided by .NET's Main() method) and disabled it because it turned out to be a bad idea
git-svn-id: file:///srv/devel/repo-conversion/nusu@130 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
47b0039137
commit
a2331b95c1
7 changed files with 182 additions and 389 deletions
|
@ -194,6 +194,14 @@ namespace Nuclex.Support.Parsing {
|
|||
|
||||
#endregion // class ArgumentTest
|
||||
|
||||
/// <summary>Verifies that the default constructor is working</summary>
|
||||
[Test]
|
||||
public void TestDefaultConstructor() {
|
||||
CommandLine commandLine = new CommandLine();
|
||||
|
||||
Assert.AreEqual(0, commandLine.Arguments.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates that the parser can handle an argument initiator with an
|
||||
/// assignment that is missing a name
|
||||
|
@ -302,7 +310,7 @@ namespace Nuclex.Support.Parsing {
|
|||
/// <summary>Validates that null can be parsed</summary>
|
||||
[Test]
|
||||
public void TestParseNull() {
|
||||
CommandLine commandLine = CommandLine.Parse(null);
|
||||
CommandLine commandLine = CommandLine.Parse((string)null);
|
||||
|
||||
Assert.AreEqual(0, commandLine.Arguments.Count);
|
||||
}
|
||||
|
@ -558,6 +566,19 @@ namespace Nuclex.Support.Parsing {
|
|||
Assert.AreEqual("//world", commandLine.Arguments[1].Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests whether the existence of named arguments can be checked
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestHasArgument() {
|
||||
CommandLine test = CommandLine.Parse("/first:x /second:y /second:z third");
|
||||
|
||||
Assert.IsTrue(test.HasArgument("first"));
|
||||
Assert.IsTrue(test.HasArgument("second"));
|
||||
Assert.IsFalse(test.HasArgument("third"));
|
||||
Assert.IsFalse(test.HasArgument("fourth"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace Nuclex.Support.Parsing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue