コード例 #1
0
        public void ShouldFailToParseInvalidString()
        {
            var regexParser = BasicParsers.GetRegexParser(new Regex("[a-z]+"));
            var result      = regexParser.Parse("234345") as Error <string>;

            Assert.AreEqual("Expected match on '[a-z]+', got '234345'.", result?.Message);
        }
コード例 #2
0
        public void ShouldReturnCorrectRestToParse2()
        {
            var stringParser = BasicParsers.GetRegexParser(new Regex("[a-z]+"));
            var result       = stringParser.Parse("whatever man");

            Assert.AreEqual(" man", result.Rest);
        }
コード例 #3
0
        public void ShouldParseRegularExpression()
        {
            var regexParser = BasicParsers.GetRegexParser(new Regex("[a-z]+"));
            var result      = regexParser.Parse("whatever multipe words");

            Assert.AreEqual("whatever", result.Output);
        }