public void TestWrongLine() { SpeakParser parser = Setup("john sayan \"hello\" \n"); var context = parser.line(); Assert.IsInstanceOfType(context, typeof(SpeakParser.LineContext)); Assert.AreEqual("john", context.name().GetText()); Assert.IsNull(context.SAYS()); Assert.AreEqual("johnsayan\"hello\"\n", context.GetText()); }
public void TestLine() { SpeakParser parser = Setup("john says \"hello\" \n"); SpeakParser.LineContext context = parser.line(); SpeakVisitor visitor = new SpeakVisitor(); SpeakLine line = (SpeakLine)visitor.VisitLine(context); Assert.AreEqual("john", line.Person); Assert.AreEqual("hello", line.Text); }