Esempio n. 1
0
        public void TestNoRepeatsVisit() /*throws Exception*/
        {
            TreeWizard wiz      = new TreeWizard(adaptor, tokens);
            CommonTree t        = (CommonTree)wiz.Create("(A B C D)");
            IList      elements = new List <object>();

            wiz.Visit(t, wiz.GetTokenType("B"), new testNoRepeatsVisit_TreeWizard_Visitor(elements));
            string found     = elements.ToElementString();
            string expecting = "[B]";

            Assert.AreEqual(expecting, found);
        }
Esempio n. 2
0
        public void TestRepeatsVisitWithNullParentAndContext() /*throws Exception*/
        {
            TreeWizard wiz      = new TreeWizard(adaptor, tokens);
            CommonTree t        = (CommonTree)wiz.Create("(A B (A C B) B D D)");
            IList      elements = new List <object>();

            wiz.Visit(t, wiz.GetTokenType("A"),
                      new testRepeatsVisitWithContext_TreeWizard_Visitor(elements));
            string found     = elements.ToElementString();
            string expecting = "[A@nil[0], A@A[1]]";

            Assert.AreEqual(expecting, found);
        }