Remove supportsNamedCapturingGroup flag in tests
Now it is true on all platforms
This commit is contained in:
committed by
Space Team
parent
175566fe56
commit
2248f4ea33
@@ -9,8 +9,6 @@ public expect fun assertTypeEquals(expected: Any?, actual: Any?)
|
||||
|
||||
public expect val isFloat32RangeEnforced: Boolean
|
||||
|
||||
public expect val supportsNamedCapturingGroup: Boolean
|
||||
|
||||
public expect val supportsOctalLiteralInRegex: Boolean
|
||||
|
||||
public expect val supportsEscapeAnyCharInRegex: Boolean
|
||||
|
||||
@@ -53,10 +53,6 @@ compileKotlin {
|
||||
compileTestKotlin {
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
systemProperty("supportsNamedCapturingGroup", false)
|
||||
}
|
||||
|
||||
configureFrontendIr(project)
|
||||
|
||||
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk7')
|
||||
|
||||
@@ -17,8 +17,6 @@ public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatf
|
||||
// TODO: should be true at least in JS IR after implementing KT-24975
|
||||
public actual val isFloat32RangeEnforced: Boolean = false
|
||||
|
||||
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
||||
|
||||
public actual val supportsOctalLiteralInRegex: Boolean get() = false
|
||||
|
||||
public actual val supportsEscapeAnyCharInRegex: Boolean get() = false
|
||||
|
||||
@@ -19,9 +19,6 @@ public fun <T> platformNull() = Collections.singletonList(null as T).first()
|
||||
|
||||
public actual val isFloat32RangeEnforced: Boolean = true
|
||||
|
||||
public actual val supportsNamedCapturingGroup: Boolean
|
||||
get() = System.getProperty("supportsNamedCapturingGroup")?.toBooleanStrict() ?: true
|
||||
|
||||
public actual val supportsOctalLiteralInRegex: Boolean get() = true
|
||||
|
||||
public actual val supportsEscapeAnyCharInRegex: Boolean get() = true
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
package test.text
|
||||
|
||||
import test.regexSplitUnicodeCodePointHandling
|
||||
import test.supportsNamedCapturingGroup
|
||||
import test.supportsOctalLiteralInRegex
|
||||
import test.supportsEscapeAnyCharInRegex
|
||||
import test.BackReferenceHandling
|
||||
@@ -174,8 +173,6 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun matchNamedGroups() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
val regex = "\\b(?<city>[A-Za-z\\s]+),\\s(?<state>[A-Z]{2}):\\s(?<areaCode>[0-9]{3})\\b".toRegex()
|
||||
val input = "Coordinates: Austin, TX: 123"
|
||||
|
||||
@@ -190,16 +187,12 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun matchDuplicateGroupName() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
// should fail with IllegalArgumentException, but JS fails with SyntaxError
|
||||
assertFails { "(?<hi>hi)|(?<hi>bye)".toRegex() }
|
||||
assertFails { "(?<first>\\d+)-(?<first>\\d+)".toRegex() }
|
||||
}
|
||||
|
||||
@Test fun matchOptionalNamedGroup() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
"(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE).let { regex ->
|
||||
val hiMatch = regex.find("Hi!")!!
|
||||
val hiGroups = hiMatch.groups
|
||||
@@ -278,8 +271,6 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun matchNamedGroupsWithBackReference() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
"(?<title>\\w+), yes \\k<title>".toRegex().let { regex ->
|
||||
val match = regex.find("Do you copy? Sir, yes Sir!")!!
|
||||
assertEquals("Sir, yes Sir", match.value)
|
||||
@@ -313,8 +304,6 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun invalidNamedGroupDeclaration() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
// should fail with IllegalArgumentException, but JS fails with SyntaxError
|
||||
|
||||
assertFails {
|
||||
@@ -467,8 +456,6 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun replaceWithNamedGroups() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
val pattern = Regex("(?<first>\\d+)-(?<second>\\d+)")
|
||||
|
||||
"123-456".let { input ->
|
||||
@@ -499,8 +486,6 @@ class RegexTest {
|
||||
}
|
||||
|
||||
@Test fun replaceWithNamedOptionalGroups() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
val regex = "(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE)
|
||||
|
||||
assertEquals("[Hi, ]gh wall", regex.replace("High wall", "[$1, $2]"))
|
||||
|
||||
@@ -17,8 +17,6 @@ public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatf
|
||||
// TODO: See KT-24975
|
||||
public actual val isFloat32RangeEnforced: Boolean = false
|
||||
|
||||
public actual val supportsNamedCapturingGroup: Boolean get() = true
|
||||
|
||||
public actual val supportsOctalLiteralInRegex: Boolean get() = true
|
||||
|
||||
public actual val supportsEscapeAnyCharInRegex: Boolean get() = true
|
||||
|
||||
Reference in New Issue
Block a user