public void chompBalanced() { TokenQueue tq = new TokenQueue(":contains(one (two) three) four"); string pre = tq.ConsumeTo("("); string guts = tq.ChompBalanced('(', ')'); string remainder = tq.Remainder(); Assert.AreEqual(":contains", pre); Assert.AreEqual("one (two) three", guts); Assert.AreEqual(" four", remainder); }
public void chompBalancedMatchesAsMuchAsPossible() { TokenQueue tq = new TokenQueue("unbalanced(something(or another"); tq.ConsumeTo("("); string match = tq.ChompBalanced('(', ')'); Assert.AreEqual("something(or another", match); }