diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-18 07:39:47 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-18 07:39:47 -0700 |
commit | 22603938a79b5c42fd607849608991977ff4ff81 (patch) | |
tree | e28671a7b1a06d6a066b55cf6ea67287b4c3a175 /tests/test_regexlexer.py | |
parent | cb7de16b36d3ea35968c94b9e6fddab8df0a10c9 (diff) | |
parent | 99fba293818c780ce48e990e973c9df24ec6c8c0 (diff) | |
download | pygments-22603938a79b5c42fd607849608991977ff4ff81.tar.gz |
Merged in jaingaurav2/pygments-main-c-cleanup (pull request #342)
Add ability to specify default state transition
Diffstat (limited to 'tests/test_regexlexer.py')
-rw-r--r-- | tests/test_regexlexer.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_regexlexer.py b/tests/test_regexlexer.py index b12dce0a..546dfcae 100644 --- a/tests/test_regexlexer.py +++ b/tests/test_regexlexer.py @@ -12,6 +12,7 @@ import unittest from pygments.token import Text from pygments.lexer import RegexLexer from pygments.lexer import bygroups +from pygments.lexer import default class TestLexer(RegexLexer): @@ -20,6 +21,7 @@ class TestLexer(RegexLexer): 'root': [ ('a', Text.Root, 'rag'), ('e', Text.Root), + default(('beer', 'beer')) ], 'beer': [ ('d', Text.Beer, ('#pop', '#pop')), @@ -45,3 +47,8 @@ class TupleTransTest(unittest.TestCase): 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')]) |