Skip to content

Commit

Permalink
Updated command-line to handle special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
phatboyg committed Sep 21, 2014
1 parent ba1ed64 commit 6cfeffe
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/Topshelf.Tests/CommandLine_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,40 @@ public void Extensible_the_command_line_should_be_yes()
Assert.IsTrue(isSuperfly);
}

[Test]
public void Need_to_handle_crazy_special_characters_in_arguments()
{
string password = null;

Host host = HostFactory.New(x =>
{
x.Service<MyService>();
x.AddCommandLineDefinition("password", v => password = v);
x.ApplyCommandLine("-password:abc123!@#=$%^&*()-+");
});

Assert.AreEqual("abc123!@#=$%^&*()-+", password);
}

[Test]
public void Need_to_handle_crazy_special_characters_in_argument()
{
string password = null;

Host host = HostFactory.New(x =>
{
x.Service<MyService>();
x.AddCommandLineDefinition("password", v => password = v);
x.ApplyCommandLine("-password \"abc123=:,.<>/?;!@#$%^&*()-+\"");
});

Assert.AreEqual("abc123=:,.<>/?;!@#$%^&*()-+", password);
}

[Test]
public void Extensible_the_command_line_should_be_yet_again()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ from c in Char(char.IsLetter)
from cs in Rep(Char(char.IsLetterOrDigit).Or(Char('.')))
select cs.Aggregate(c.ToString(), (s, ch) => s + ch);

Value = (from symbol in Rep(Char(char.IsLetterOrDigit).Or(Char(char.IsPunctuation)))
Value = (from symbol in Rep(Char(char.IsLetterOrDigit).Or(Char(char.IsPunctuation)).Or(Char(char.IsSymbol)))
select symbol.Aggregate("", (s, ch) => s + ch));

Definition = (from w in Whitespace
Expand Down

0 comments on commit 6cfeffe

Please sign in to comment.