public void ParseAWorks() { var parser = new StartsWithChar('A'); var result = parser.Parse("A"); Assert.IsTrue(result.Success); Assert.AreEqual("A", result.Parsed); Assert.AreEqual("", result.Remainder); }
public void OneIs1() { var parser = new StartsWithChar('1').ApplyString(l => int.Parse(l)); var result = parser.Parse("1"); Assert.IsTrue(result.Success); Assert.AreEqual(1, result.Parsed); Assert.AreEqual("", result.Remainder); }
public void ParseBADoesNotWork() { var parser = new StartsWithChar('A'); var result = parser.Parse("BA"); Assert.IsFalse(result.Success); Assert.IsNull(result.Parsed); Assert.AreEqual("BA", result.Remainder); }