示例#1
0
        public void Many0Test()
        {
            Combinator.Many0(Parser.Fail <Char, Char>("Failure"))
            .Run("inputString".AsStream())
            .Case(
                failure: (restStream, _) => Assert.Fail(),
                success: (restStream, value) =>
            {
                Assert.False(value.Any());
            });

            Combinator.Many0(Chars.Any())
            .Run("inputString".AsStream())
            .Case(
                failure: (restStream, _) => Assert.Fail(),
                success: (restStream, value) =>
            {
                Assert.True(Enumerable.SequenceEqual(value, "inputString"));
            });
        }