示例#1
0
        public virtual void AddFirst()
        {
            TokenQueue tq = new TokenQueue("One Two");

            tq.ConsumeWord();
            tq.AddFirst("Three");
            NUnit.Framework.Assert.AreEqual("Three Two", tq.Remainder());
        }
示例#2
0
        public virtual void ChompBalancedMatchesAsMuchAsPossible()
        {
            TokenQueue tq = new TokenQueue("unbalanced(something(or another");

            tq.ConsumeTo("(");
            String match = tq.ChompBalanced('(', ')');

            NUnit.Framework.Assert.AreEqual("something(or another", match);
        }
示例#3
0
        public virtual void ChompToIgnoreCase()
        {
            String     t    = "<textarea>one < two </TEXTarea>";
            TokenQueue tq   = new TokenQueue(t);
            String     data = tq.ChompToIgnoreCase("</textarea");

            NUnit.Framework.Assert.AreEqual("<textarea>one < two ", data);
            tq   = new TokenQueue("<textarea> one two < three </oops>");
            data = tq.ChompToIgnoreCase("</textarea");
            NUnit.Framework.Assert.AreEqual("<textarea> one two < three </oops>", data);
        }
示例#4
0
        public virtual void ChompBalanced()
        {
            TokenQueue tq        = new TokenQueue(":contains(one (two) three) four");
            String     pre       = tq.ConsumeTo("(");
            String     guts      = tq.ChompBalanced('(', ')');
            String     remainder = tq.Remainder();

            NUnit.Framework.Assert.AreEqual(":contains", pre);
            NUnit.Framework.Assert.AreEqual("one (two) three", guts);
            NUnit.Framework.Assert.AreEqual(" four", remainder);
        }
示例#5
0
 public virtual void Unescape()
 {
     NUnit.Framework.Assert.AreEqual("one ( ) \\", TokenQueue.Unescape("one \\( \\) \\\\"));
 }