File tree Expand file tree Collapse file tree
src/Utility.CommandLine.Arguments
tests/Utility.CommandLine.Arguments.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ public class Arguments
176176 /// <summary>
177177 /// The regular expression with which to parse the command line string.
178178 /// </summary>
179- private const string ArgumentRegEx = "(?:[-]{1,2}|\\ /)([^=: ]+)[=: ]?(\\ /?\\ w \\ S*|\\ \" [^\" ]*\\ \" |\\ \' [^']*\\ \' )?|([^ ([^'\\ \" ]+|\" [^\\ \" ]+\" |\\ \' [^']+\\ \' )" ;
179+ private const string ArgumentRegEx = "(?:[-]{1,2}|\\ /)([^=: ]+)[=: ]?(\\ /?[^-' \" ] \\ S*|\\ \" [^\" ]*\\ \" |\\ \' [^']*\\ \' )?|([^ ([^'\\ \" ]+|\" [^\\ \" ]+\" |\\ \' [^']+\\ \' )" ;
180180
181181 /// <summary>
182182 /// The regular expression with which to parse argument-value groups.
Original file line number Diff line number Diff line change @@ -383,6 +383,25 @@ public void ParseValueWithQuotedPeriod()
383383 Assert . Equal ( "test2.test2" , test [ "test2" ] ) ;
384384 }
385385
386+ [ Theory ]
387+ [ InlineData ( "." ) ]
388+ [ InlineData ( ".." ) ]
389+ [ InlineData ( "..\\ " ) ]
390+ [ InlineData ( ".\\ foo" ) ]
391+ [ InlineData ( "..\\ foo" ) ]
392+ [ InlineData ( "..\\ .." ) ]
393+ [ InlineData ( "\\ " ) ]
394+ [ InlineData ( "\\ foo" ) ]
395+ [ InlineData ( "\\ foo\\ bar" ) ]
396+ [ InlineData ( "\\ \\ foo" ) ]
397+ [ InlineData ( "\\ \\ foo\\ bar" ) ]
398+ public void ParseValueStartingWithNonWord ( string value )
399+ {
400+ Dictionary < string , object > test = Arguments . Parse ( $ "-f { value } ") . ArgumentDictionary ;
401+
402+ Assert . Equal ( value , test [ "f" ] ) ;
403+ }
404+
386405 [ Fact ]
387406 public void Populate ( )
388407 {
You can’t perform that action at this time.
0 commit comments