public void EndBy0Test() { Combinator.EndBy0( Parser.Fail <Char, Char>("Failure"), Parser.Fail <Char, Unit>("Failure")) .Run("inputString".AsStream()) .Case( failure: (restStream, _) => Assert.Fail(), success: (restStream, value) => { Assert.False(value.Any()); }); Combinator.EndBy0( Chars.Any(), Chars.Char(',').Ignore()) .Run("i,n,p,u,t,S,t,r,i,n,g,".AsStream()) .Case( failure: (restStream, _) => Assert.Fail(), success: (restStream, value) => { Assert.True(Enumerable.SequenceEqual(value, "inputString")); Assert.False(restStream.Current.HasValue); }); Combinator.EndBy0( Chars.Any(), Chars.Char(',').Ignore()) .Run("i,n,p,u,t,S,t,r,i,n,g".AsStream()) .Case( failure: (restStream, _) => Assert.Fail(), success: (restStream, value) => { Assert.True(Enumerable.SequenceEqual(value, "inputStrin")); Assert.True(restStream.Current.HasValue); Assert.AreEqual('g', restStream.Current.Value.Item0); Assert.AreEqual(1, restStream.Current.Value.Item1.Line); Assert.AreEqual(21, restStream.Current.Value.Item1.Column); }); }