コード例 #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 \\( \\) \\\\"));
 }