public void TestTokenizer4() { QuotedStringTokenizer tok = new QuotedStringTokenizer("abc'def,ghi'jkl", ","); tok.SingleQuotes = false; Assert.AreEqual("abc'def", tok.NextToken()); Assert.AreEqual("ghi'jkl", tok.NextToken()); tok = new QuotedStringTokenizer("abc'def,ghi'jkl", ","); tok.SingleQuotes = true; Assert.AreEqual("abcdef,ghijkl", tok.NextToken()); }
private void CheckTok(QuotedStringTokenizer tok, bool delim, bool quotes) { Assert.IsTrue(tok.HasMoreElements()); Assert.IsTrue(tok.hasMoreTokens()); Assert.AreEqual("abc", tok.NextToken()); if (delim) { Assert.AreEqual(",", tok.NextToken()); } if (delim) { Assert.AreEqual(" ", tok.NextToken()); } Assert.AreEqual(quotes ? "\"d\\\"'\"" : "d\"'", tok.NextElement()); if (delim) { Assert.AreEqual(",", tok.NextToken()); } Assert.AreEqual(quotes ? "'p\\',y'" : "p',y", tok.NextToken()); if (delim) { Assert.AreEqual(" ", tok.NextToken()); } Assert.AreEqual("z", tok.NextToken()); Assert.IsFalse(tok.hasMoreTokens()); }