diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
commit | 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 (patch) | |
tree | 87a171383266dd1f64196589af081bc2f8e497c3 /tests/test_regexlexer.py | |
parent | f1c080e184dc1bbc36eaa7cd729ff3a499de568a (diff) | |
download | pygments-master.tar.gz |
Diffstat (limited to 'tests/test_regexlexer.py')
-rw-r--r-- | tests/test_regexlexer.py | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/test_regexlexer.py b/tests/test_regexlexer.py deleted file mode 100644 index adc05a93..00000000 --- a/tests/test_regexlexer.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Pygments regex lexer tests - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import unittest - -from pygments.token import Text -from pygments.lexer import RegexLexer -from pygments.lexer import default - - -class TestLexer(RegexLexer): - """Test tuple state transitions including #pop.""" - tokens = { - 'root': [ - ('a', Text.Root, 'rag'), - ('e', Text.Root), - ('#', Text.Root, '#pop'), - ('@', Text.Root, ('#pop', '#pop')), - default(('beer', 'beer')) - ], - 'beer': [ - ('d', Text.Beer, ('#pop', '#pop')), - ], - 'rag': [ - ('b', Text.Rag, '#push'), - ('c', Text.Rag, ('#pop', 'beer')), - ], - } - - -class TupleTransTest(unittest.TestCase): - def test(self): - lx = TestLexer() - toks = list(lx.get_tokens_unprocessed('abcde')) - self.assertEqual(toks, [ - (0, Text.Root, 'a'), (1, Text.Rag, 'b'), (2, Text.Rag, 'c'), - (3, Text.Beer, 'd'), (4, Text.Root, 'e')]) - - def test_multiline(self): - lx = TestLexer() - toks = list(lx.get_tokens_unprocessed('a\ne')) - self.assertEqual(toks, [ - (0, Text.Root, 'a'), (1, Text, u'\n'), (2, Text.Root, 'e')]) - - def test_default(self): - lx = TestLexer() - toks = list(lx.get_tokens_unprocessed('d')) - self.assertEqual(toks, [(0, Text.Beer, 'd')]) - - -class PopEmptyTest(unittest.TestCase): - def test_regular(self): - lx = TestLexer() - toks = list(lx.get_tokens_unprocessed('#e')) - self.assertEqual(toks, [(0, Text.Root, '#'), (1, Text.Root, 'e')]) - - def test_tuple(self): - lx = TestLexer() - toks = list(lx.get_tokens_unprocessed('@e')) - self.assertEqual(toks, [(0, Text.Root, '@'), (1, Text.Root, 'e')]) |