Ejemplo n.º 1
0
        public void TestThrowsIfCallingConsumeInterfaceWhenNextIsNotInterface()
        {
            string code = "class MyClass { class MyClass2 { function foo() { } } }";

              LookAheadLangParser textParser = LookAheadLangParser.CreateJavascriptParser(TestUtil.GetTextStream(code));
              var parser = new JSParser(textParser);
              parser.ConsumeInterface();
        }
Ejemplo n.º 2
0
        public void TestConsumesTypeScriptInterfaces()
        {
            string code = "interface Thing { intersect: (ray: Ray); normal: (pos: Vector); } NEXT";

              LookAheadLangParser textParser = LookAheadLangParser.CreateJavascriptParser(TestUtil.GetTextStream(code));
              var parser = new JSParser(textParser);

              Assert.IsTrue(parser.NextIsInterface());

              parser.ConsumeInterface();

              Assert.AreEqual("NEXT", textParser.NextKeyword());
        }