Ejemplo n.º 1
0
 public void Quoted_arguments_should_be_parsed_correctly()
 {
     var tn = new CmdTokenizer("\"testParam testParam2\"");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam testParam2", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 2
0
 public void Double_quotes_should_be_treated_like_a_normal_char()
 {
     var tn = new CmdTokenizer("\"testParam \"\"testParam2\"\"\"");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam \"testParam2\"", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 3
0
 public void Double_quotes_in_unclosed_quotes_should_work_like_the_string_is_closed_at_the_end()
 {
     var tn = new CmdTokenizer("\"testParam \"\"testParam2\"\"");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam \"testParam2\"", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 4
0
 public void Single_argument_should_be_parsed_correctly()
 {
     var tn = new CmdTokenizer("testParam");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
     Assert.AreEqual("", tn.ReadNext());
 }
Ejemplo n.º 5
0
 public void Quoted_Paramter_should_not_affect_the_following_parameter()
 {
     var tn = new CmdTokenizer("\"testParam\" testParam2");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam", tn.ReadNext());
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam2", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 6
0
 public void Closing_quote_should_end_the_current_parameter()
 {
     var tn = new CmdTokenizer("\"testParam testParam2\"testParam3");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam testParam2", tn.ReadNext());
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam3", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 7
0
 public void Unclosed_quote_should_end_at_the_end_of_the_string()
 {
     var tn = new CmdTokenizer("\"testParam testParam2");
     Assert.AreEqual(true, tn.HasMore);
     Assert.AreEqual("testParam testParam2", tn.ReadNext());
     Assert.AreEqual(false, tn.HasMore);
 }
Ejemplo n.º 8
0
 public void Empty_cmd_should_be_recognized()
 {
     var tn = new CmdTokenizer("");
     Assert.AreEqual(false, tn.HasMore);
     Assert.AreEqual("", tn.ReadNext());
 }