[smuxi/stable: 296/301] Engine(-Tests): fixed regression in command parser



commit c241c1df3a4691f97c97a3822a76bed9c43fc859
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Dec 17 15:00:20 2013 +0100

    Engine(-Tests): fixed regression in command parser

 src/Engine-Tests/CommandModelTests.cs |    5 +++++
 src/Engine/CommandModel.cs            |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine-Tests/CommandModelTests.cs b/src/Engine-Tests/CommandModelTests.cs
index b5dea37..4f7dc9b 100644
--- a/src/Engine-Tests/CommandModelTests.cs
+++ b/src/Engine-Tests/CommandModelTests.cs
@@ -39,6 +39,11 @@ namespace Smuxi.Engine
             Assert.AreEqual("test", cmd.Command);
             Assert.AreEqual("", cmd.Parameter);
 
+            cmd = new CommandModel(null, null, "/", "/generate_messages 100");
+            Assert.IsTrue(cmd.IsCommand);
+            Assert.AreEqual("generate_messages", cmd.Command);
+            Assert.AreEqual("100", cmd.Parameter);
+
             cmd = new CommandModel(null, null, "/", "/test foo bar");
             Assert.IsTrue(cmd.IsCommand);
             Assert.AreEqual("test", cmd.Command);
diff --git a/src/Engine/CommandModel.cs b/src/Engine/CommandModel.cs
index 6167be7..994a1aa 100644
--- a/src/Engine/CommandModel.cs
+++ b/src/Engine/CommandModel.cs
@@ -170,7 +170,7 @@ namespace Smuxi.Engine
         void EnhancedParse(string data)
         {
             string regex = Regex.Escape(_CommandCharacter);
-            regex += "(?<command>[a-z]+)"; // commands can only contain english keyboard letters
+            regex += "(?<command>[a-z_-]+)"; // commands can only contain english keyboard letters
             string quoted_parameter = @"""(?<parameters>[^""]*)""";
             string normal_parameter = @"(?<parameters>[^ ]+)";
             string parameters = @"( +(" + quoted_parameter + "|" + normal_parameter + "))*";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]