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

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

            Assert.IsNull(token);
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #4
0
        public void TestWithMissingClosingCharacter()
        {
            var extractor = new ParenthesisedTokenExtractor('[', ']');

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