Test octal literal in regex
This commit is contained in:
committed by
Space
parent
46408ffd9d
commit
74121b26c0
@@ -9,6 +9,7 @@ package test.text
|
||||
|
||||
import test.regexSplitUnicodeCodePointHandling
|
||||
import test.supportsNamedCapturingGroup
|
||||
import test.supportsOctalLiteralInRegex
|
||||
import test.BackReferenceHandling
|
||||
import test.HandlingOption
|
||||
import kotlin.test.*
|
||||
@@ -242,6 +243,14 @@ class RegexTest {
|
||||
testInvalidBackReference(BackReferenceHandling.notYetDefinedGroup, pattern = "a\\1(a)")
|
||||
}
|
||||
|
||||
@Test fun matchCharWithOctalValue() {
|
||||
if (supportsOctalLiteralInRegex) {
|
||||
assertEquals("aa", "a\\0141".toRegex().find("aaaa")?.value)
|
||||
} else {
|
||||
assertFails { "a\\0141".toRegex() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun matchNamedGroupsWithBackReference() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user