47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
import re
|
|
|
|
import pytest
|
|
|
|
from standardize_test_format import (
|
|
PATTERN_DISPLAY_NAME_1,
|
|
PATTERN_DISPLAY_NAME_EXPRESSION,
|
|
PATTERN_JAVADOC,
|
|
)
|
|
|
|
VALID_JAVADOCS = [
|
|
'/** Hello World */',
|
|
'/** Hello\n * World */',
|
|
'/**\n * Hello World\n */',
|
|
]
|
|
|
|
|
|
VALID_DISPLAY_NAME_EXPRESSIONS = [
|
|
'"Hello"',
|
|
' "Hello" ',
|
|
'"Hello " + " World!"',
|
|
]
|
|
|
|
|
|
VALID_DISPLAY_NAMES = [
|
|
'@DisplayName("test")',
|
|
'@DisplayName( "test" )',
|
|
'@DisplayName(\n"test"\n)',
|
|
'@DisplayName("Hello " + " World!")',
|
|
'@DisplayName("Hello "\n+\n" World!")',
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize('text', VALID_JAVADOCS)
|
|
def test_javadoc_parsing(text: str):
|
|
assert re.match(PATTERN_JAVADOC, text) is not None
|
|
|
|
|
|
@pytest.mark.parametrize('text', VALID_DISPLAY_NAMES)
|
|
def test_display_name_parsing(text: str):
|
|
assert re.match(PATTERN_DISPLAY_NAME_1, text) is not None
|
|
|
|
|
|
@pytest.mark.parametrize('text', VALID_DISPLAY_NAME_EXPRESSIONS)
|
|
def test_display_name_expressions(text: str):
|
|
assert re.match(PATTERN_DISPLAY_NAME_EXPRESSION, text) is not None
|