コード例 #1
0
ファイル: JSParserTests.cs プロジェクト: wyrover/ccm
        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();
        }
コード例 #2
0
ファイル: JSParserTests.cs プロジェクト: wyrover/ccm
        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());
        }