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(); }
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()); }