예제 #1
0
        public static void FailsWith <T>(TokenListParser <char, T> parser, string input,
                                         Action <TokenListParserResult <char, T> > resultAssertion)
        {
            var result = parser.TryParse(StringAsCharTokenList.Tokenize((input)));

            if (result.HasValue)
            {
                Assert.False(result.HasValue, $"Expected failure but succeeded with {result.Value}.");
            }

            resultAssertion(result);
        }
예제 #2
0
        public static void FailsWithMessage <T>(TokenListParser <char, T> parser, string input, string message)
        {
            var result = parser.TryParse(StringAsCharTokenList.Tokenize(input));

            Assert.Equal(message, result.ToString());
        }
예제 #3
0
        public static void Succeeds <T>(TokenListParser <char, T> parser, string input, Action <T> resultAssertion)
        {
            var t = parser.Parse(StringAsCharTokenList.Tokenize(input));

            resultAssertion(t);
        }