Test octal literal in regex
This commit is contained in:
committed by
Space
parent
46408ffd9d
commit
74121b26c0
@@ -32,6 +32,8 @@ public actual val supportsSuppressedExceptions: Boolean get() = true
|
|||||||
|
|
||||||
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
||||||
|
|
||||||
|
public actual val supportsOctalLiteralInRegex: Boolean get() = true
|
||||||
|
|
||||||
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
||||||
|
|
||||||
public actual object BackReferenceHandling {
|
public actual object BackReferenceHandling {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public expect val supportsSuppressedExceptions: Boolean
|
|||||||
|
|
||||||
public expect val supportsNamedCapturingGroup: Boolean
|
public expect val supportsNamedCapturingGroup: Boolean
|
||||||
|
|
||||||
|
public expect val supportsOctalLiteralInRegex: Boolean
|
||||||
|
|
||||||
public expect val regexSplitUnicodeCodePointHandling: Boolean
|
public expect val regexSplitUnicodeCodePointHandling: Boolean
|
||||||
|
|
||||||
public enum class HandlingOption {
|
public enum class HandlingOption {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ actual val supportsSuppressedExceptions: Boolean get() = true
|
|||||||
|
|
||||||
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
||||||
|
|
||||||
|
public actual val supportsOctalLiteralInRegex: Boolean get() = false
|
||||||
|
|
||||||
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
||||||
|
|
||||||
public actual object BackReferenceHandling {
|
public actual object BackReferenceHandling {
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public actual val supportsSuppressedExceptions: Boolean get() = !isJava6
|
|||||||
|
|
||||||
public actual val supportsNamedCapturingGroup: Boolean get() = !isJava6
|
public actual val supportsNamedCapturingGroup: Boolean get() = !isJava6
|
||||||
|
|
||||||
|
public actual val supportsOctalLiteralInRegex: Boolean get() = true
|
||||||
|
|
||||||
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = false
|
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = false
|
||||||
|
|
||||||
public actual object BackReferenceHandling {
|
public actual object BackReferenceHandling {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ package test.text
|
|||||||
|
|
||||||
import test.regexSplitUnicodeCodePointHandling
|
import test.regexSplitUnicodeCodePointHandling
|
||||||
import test.supportsNamedCapturingGroup
|
import test.supportsNamedCapturingGroup
|
||||||
|
import test.supportsOctalLiteralInRegex
|
||||||
import test.BackReferenceHandling
|
import test.BackReferenceHandling
|
||||||
import test.HandlingOption
|
import test.HandlingOption
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
@@ -242,6 +243,14 @@ class RegexTest {
|
|||||||
testInvalidBackReference(BackReferenceHandling.notYetDefinedGroup, pattern = "a\\1(a)")
|
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() {
|
@Test fun matchNamedGroupsWithBackReference() {
|
||||||
if (!supportsNamedCapturingGroup) return
|
if (!supportsNamedCapturingGroup) return
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ actual val supportsSuppressedExceptions: Boolean get() = true
|
|||||||
|
|
||||||
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
||||||
|
|
||||||
|
public actual val supportsOctalLiteralInRegex: Boolean get() = true
|
||||||
|
|
||||||
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
public actual val regexSplitUnicodeCodePointHandling: Boolean get() = true
|
||||||
|
|
||||||
public actual object BackReferenceHandling {
|
public actual object BackReferenceHandling {
|
||||||
|
|||||||
Reference in New Issue
Block a user