diff options
| author | Jean Abou-Samra <jean@abou-samra.fr> | 2023-02-23 16:41:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-23 16:41:01 +0100 |
| commit | b1f8dddc0b72923f05ec07dc9856f7fc143f6b97 (patch) | |
| tree | 275be16203ffafcc9775c1409646f9fb0ac12d53 /tests/test_java.py | |
| parent | e589fee754a76e9600dcb42baaeb3372d9e163d7 (diff) | |
| download | pygments-git-b1f8dddc0b72923f05ec07dc9856f7fc143f6b97.tar.gz | |
More tests moved to snippets/ (#2351)
Diffstat (limited to 'tests/test_java.py')
| -rw-r--r-- | tests/test_java.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/tests/test_java.py b/tests/test_java.py deleted file mode 100644 index a50e862e..00000000 --- a/tests/test_java.py +++ /dev/null @@ -1,40 +0,0 @@ -""" - Basic JavaLexer Test - ~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import time - -import pytest - -from pygments.token import String -from pygments.lexers import JavaLexer - - -@pytest.fixture(scope='module') -def lexer(): - yield JavaLexer() - - -@pytest.mark.parametrize( - 'text', - ( - '""', '"abc"', '"ひらがな"', '"123"', - '"\\\\"', '"\\t"' '"\\""', - ), -) -def test_string_literals_positive_match(lexer, text): - """Test positive matches for string literals.""" - tokens = list(lexer.get_tokens_unprocessed(text)) - assert all([token is String for _, token, _ in tokens]) - assert ''.join([value for _, _, value in tokens]) == text - - -def test_string_literals_backtracking(lexer): - """Test catastrophic backtracking for string literals.""" - start_time = time.time() - list(lexer.get_tokens_unprocessed('"' + '\\' * 100)) - assert time.time() - start_time < 1, 'possible backtracking bug' |
