Permalink
Browse files

moved the @ after the parameter name

  • Loading branch information...
1 parent 4845864 commit a3da2073059253217df6e2509c0fcb6be38bff91 @adrianaisemberg adrianaisemberg committed Oct 24, 2011
Showing with 9 additions and 9 deletions.
  1. +4 −4 CLAP/Parser.cs
  2. +5 −5 Tests/Tests.cs
View
8 CLAP/Parser.cs
@@ -21,7 +21,7 @@ public sealed class Parser<T>
// The possible prefixes of a parameter
//
private readonly static string[] s_prefixes = new[] { "/", "-" };
- private readonly static string s_fileInputPrefix = "@";
+ private readonly static string s_fileInputSuffix = "@";
private readonly Dictionary<string, GlobalParameterHandler> m_globalRegisteredHandlers;
@@ -782,11 +782,11 @@ private static string GetParameterOption(Parameter p)
{
valueString = parts[1];
- // if it has a file input prefix - remove it
+ // if it has a file input suffix - remove it
//
- if (name.StartsWith(s_fileInputPrefix))
+ if (name.EndsWith(s_fileInputSuffix))
{
- name = name.Substring(1);
+ name = name.Substring(0, name.Length - 1);
// the value is replaced with the content of the input file
//
View
10 Tests/Tests.cs
@@ -1620,7 +1620,7 @@ public void Execute_WithFileInput_String()
Parser.Run(new[]
{
- "-@str=some_dummy_file"
+ "-str@=some_dummy_file"
}, s);
Assert.AreEqual("kicks ass!", s.Values["str"]);
@@ -1635,7 +1635,7 @@ public void Execute_WithFileInput_Int()
Parser.Run(new[]
{
- "-@num=some_dummy_file"
+ "-num@=some_dummy_file"
}, s);
Assert.AreEqual(567, s.Values["num"]);
@@ -1650,7 +1650,7 @@ public void Execute_WithFileInput_Bool()
Parser.Run(new[]
{
- "-@b=some_dummy_file"
+ "-b@=some_dummy_file"
}, s);
Assert.AreEqual(false, s.Values["b"]);
@@ -1665,7 +1665,7 @@ public void Execute_WithFileInput_Enum()
Parser.Run(new[]
{
- "-@c=some_dummy_file"
+ "-c@=some_dummy_file"
}, s);
Assert.AreEqual(Case.Unchanged, s.Values["c"]);
@@ -1680,7 +1680,7 @@ public void Execute_WithFileInput_Array()
Parser.Run(new[]
{
- "-@numbers=some_dummy_file"
+ "-numbers@=some_dummy_file"
}, s);
var arr = (int[])s.Values["numbers"];

0 comments on commit a3da207

Please sign in to comment.