[Test] Allow testcases with number 0 in spec test
There was a hidden bug which was uncovered by KT-58936
This commit is contained in:
@@ -93,7 +93,8 @@ object LinkedSpecTestPatterns : BasePatterns {
|
|||||||
object TestCasePatterns {
|
object TestCasePatterns {
|
||||||
private const val TEST_CASE_CODE_REGEX = """(?<%s>[\s\S]*?)"""
|
private const val TEST_CASE_CODE_REGEX = """(?<%s>[\s\S]*?)"""
|
||||||
|
|
||||||
private val testCaseInfoElementsRegex = """(?<%s>%s${SpecTestCaseInfoElementType.TESTCASE_NUMBER.name.withSpaces()}:%s*?\n)"""
|
// Lazy is needed to prevent cycle initialization dependency between this object and SpecTestCaseInfoElementType
|
||||||
|
private val testCaseInfoElementsRegex by lazy { """(?<%s>%s${SpecTestCaseInfoElementType.TESTCASE_NUMBER.name.withSpaces()}:%s*?\n)""" }
|
||||||
private val testCaseInfoRegex = """$TEST_CASE_CODE_REGEX(?<%s>(?:$directiveRegex)|$)"""
|
private val testCaseInfoRegex = """$TEST_CASE_CODE_REGEX(?<%s>(?:$directiveRegex)|$)"""
|
||||||
private val testCaseInfoSingleLineRegex =
|
private val testCaseInfoSingleLineRegex =
|
||||||
SINGLE_LINE_COMMENT_REGEX.format(
|
SINGLE_LINE_COMMENT_REGEX.format(
|
||||||
@@ -105,5 +106,5 @@ object TestCasePatterns {
|
|||||||
) + testCaseInfoRegex.format("codeML", "nextDirectiveML")
|
) + testCaseInfoRegex.format("codeML", "nextDirectiveML")
|
||||||
|
|
||||||
val testCaseInfoPattern: Pattern = Pattern.compile("(?:$testCaseInfoSingleLineRegex)|(?:$testCaseInfoMultilineRegex)")
|
val testCaseInfoPattern: Pattern = Pattern.compile("(?:$testCaseInfoSingleLineRegex)|(?:$testCaseInfoMultilineRegex)")
|
||||||
val testCaseNumberPattern: Pattern = Pattern.compile("""([1-9]\d*)(,\s*[1-9]\d*)*""")
|
val testCaseNumberPattern: Pattern = Pattern.compile("""([0-9]\d*)(,\s*[1-9]\d*)*""")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user