Skip to content

Commit

Permalink
add regression coverage for perf issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gerner committed Dec 3, 2020
1 parent c88881c commit cae94be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_markdown_lexer.py
Expand Up @@ -634,3 +634,11 @@ def test_simple_text(lexer):
(Token.Text, '\n'),
]
assert list(lexer.get_tokens(fragment)) == tokens

def test_long_line_perf(lexer):
# note, this test is weak enough to pass in pypy, so much so that in
# cpython it doesn't actually provide much perf regression coverage
fragment = "this is text\n"*1024
start_time = time.time()
assert all(x[0] == Token.Text for x in lexer.get_tokens(fragment))
assert time.time() - start_time < 5

0 comments on commit cae94be

Please sign in to comment.