Beispiel #1
0
        public void TestWithNoMatch()
        {
            var extractor = new ParenthesisedTokenExtractor('|');

            var token = extractor.ExtractToken("abc|", 0, new Context(ExpressiveOptions.None));

            Assert.IsNull(token);
        }
Beispiel #2
0
        public static void TestValidScenarios(char character, string input, string output)
        {
            var extractor = new ParenthesisedTokenExtractor(character);

            var token = extractor.ExtractToken(input, 0, new Context(ExpressiveOptions.None));

            Assert.That(token, Is.Not.Null);
            Assert.That(token.CurrentToken, Is.EqualTo(output));
        }
Beispiel #3
0
        public void TestWithValidParenthesis()
        {
            var extractor = new ParenthesisedTokenExtractor('[', ']');

            var token = extractor.ExtractToken("[abc]", 0, new Context(ExpressiveOptions.None));

            Assert.IsNotNull(token);
            Assert.AreEqual("[abc]", token.CurrentToken);
        }
Beispiel #4
0
        public void TestWithMissingClosingCharacter()
        {
            var extractor = new ParenthesisedTokenExtractor('[', ']');

            Assert.That(() => extractor.ExtractToken("[abc", 0, new Context(ExpressiveOptions.None)), Throws.InstanceOf <MissingTokenException>());
        }