Remove supportsNamedCapturingGroup flag in tests

Now it is true on all platforms
This commit is contained in:
Abduqodiri Qurbonzoda
2022-09-20 23:35:55 +03:00
committed by Space Team
parent 175566fe56
commit 2248f4ea33
7 changed files with 0 additions and 30 deletions
@@ -20,8 +20,6 @@ public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatf
public actual val isFloat32RangeEnforced: Boolean get() = true public actual val isFloat32RangeEnforced: Boolean get() = true
public actual val supportsNamedCapturingGroup: Boolean get() = true
public actual val supportsOctalLiteralInRegex: Boolean get() = true public actual val supportsOctalLiteralInRegex: Boolean get() = true
public actual val supportsEscapeAnyCharInRegex: Boolean get() = true public actual val supportsEscapeAnyCharInRegex: Boolean get() = true
@@ -9,8 +9,6 @@ public expect fun assertTypeEquals(expected: Any?, actual: Any?)
public expect val isFloat32RangeEnforced: Boolean public expect val isFloat32RangeEnforced: Boolean
public expect val supportsNamedCapturingGroup: Boolean
public expect val supportsOctalLiteralInRegex: Boolean public expect val supportsOctalLiteralInRegex: Boolean
public expect val supportsEscapeAnyCharInRegex: Boolean public expect val supportsEscapeAnyCharInRegex: Boolean
-4
View File
@@ -53,10 +53,6 @@ compileKotlin {
compileTestKotlin { compileTestKotlin {
} }
tasks.withType(Test) {
systemProperty("supportsNamedCapturingGroup", false)
}
configureFrontendIr(project) configureFrontendIr(project)
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk7') 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 // TODO: should be true at least in JS IR after implementing KT-24975
public actual val isFloat32RangeEnforced: Boolean = false public actual val isFloat32RangeEnforced: Boolean = false
public actual val supportsNamedCapturingGroup: Boolean get() = true
public actual val supportsOctalLiteralInRegex: Boolean get() = false public actual val supportsOctalLiteralInRegex: Boolean get() = false
public actual val supportsEscapeAnyCharInRegex: 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 isFloat32RangeEnforced: Boolean = true
public actual val supportsNamedCapturingGroup: Boolean
get() = System.getProperty("supportsNamedCapturingGroup")?.toBooleanStrict() ?: true
public actual val supportsOctalLiteralInRegex: Boolean get() = true public actual val supportsOctalLiteralInRegex: Boolean get() = true
public actual val supportsEscapeAnyCharInRegex: Boolean get() = true public actual val supportsEscapeAnyCharInRegex: Boolean get() = true
-15
View File
@@ -8,7 +8,6 @@
package test.text package test.text
import test.regexSplitUnicodeCodePointHandling import test.regexSplitUnicodeCodePointHandling
import test.supportsNamedCapturingGroup
import test.supportsOctalLiteralInRegex import test.supportsOctalLiteralInRegex
import test.supportsEscapeAnyCharInRegex import test.supportsEscapeAnyCharInRegex
import test.BackReferenceHandling import test.BackReferenceHandling
@@ -174,8 +173,6 @@ class RegexTest {
} }
@Test fun matchNamedGroups() { @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 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" val input = "Coordinates: Austin, TX: 123"
@@ -190,16 +187,12 @@ class RegexTest {
} }
@Test fun matchDuplicateGroupName() { @Test fun matchDuplicateGroupName() {
if (!supportsNamedCapturingGroup) return
// should fail with IllegalArgumentException, but JS fails with SyntaxError // should fail with IllegalArgumentException, but JS fails with SyntaxError
assertFails { "(?<hi>hi)|(?<hi>bye)".toRegex() } assertFails { "(?<hi>hi)|(?<hi>bye)".toRegex() }
assertFails { "(?<first>\\d+)-(?<first>\\d+)".toRegex() } assertFails { "(?<first>\\d+)-(?<first>\\d+)".toRegex() }
} }
@Test fun matchOptionalNamedGroup() { @Test fun matchOptionalNamedGroup() {
if (!supportsNamedCapturingGroup) return
"(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE).let { regex -> "(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE).let { regex ->
val hiMatch = regex.find("Hi!")!! val hiMatch = regex.find("Hi!")!!
val hiGroups = hiMatch.groups val hiGroups = hiMatch.groups
@@ -278,8 +271,6 @@ class RegexTest {
} }
@Test fun matchNamedGroupsWithBackReference() { @Test fun matchNamedGroupsWithBackReference() {
if (!supportsNamedCapturingGroup) return
"(?<title>\\w+), yes \\k<title>".toRegex().let { regex -> "(?<title>\\w+), yes \\k<title>".toRegex().let { regex ->
val match = regex.find("Do you copy? Sir, yes Sir!")!! val match = regex.find("Do you copy? Sir, yes Sir!")!!
assertEquals("Sir, yes Sir", match.value) assertEquals("Sir, yes Sir", match.value)
@@ -313,8 +304,6 @@ class RegexTest {
} }
@Test fun invalidNamedGroupDeclaration() { @Test fun invalidNamedGroupDeclaration() {
if (!supportsNamedCapturingGroup) return
// should fail with IllegalArgumentException, but JS fails with SyntaxError // should fail with IllegalArgumentException, but JS fails with SyntaxError
assertFails { assertFails {
@@ -467,8 +456,6 @@ class RegexTest {
} }
@Test fun replaceWithNamedGroups() { @Test fun replaceWithNamedGroups() {
if (!supportsNamedCapturingGroup) return
val pattern = Regex("(?<first>\\d+)-(?<second>\\d+)") val pattern = Regex("(?<first>\\d+)-(?<second>\\d+)")
"123-456".let { input -> "123-456".let { input ->
@@ -499,8 +486,6 @@ class RegexTest {
} }
@Test fun replaceWithNamedOptionalGroups() { @Test fun replaceWithNamedOptionalGroups() {
if (!supportsNamedCapturingGroup) return
val regex = "(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE) val regex = "(?<hi>hi)|(?<bye>bye)".toRegex(RegexOption.IGNORE_CASE)
assertEquals("[Hi, ]gh wall", regex.replace("High wall", "[$1, $2]")) assertEquals("[Hi, ]gh wall", regex.replace("High wall", "[$1, $2]"))
-2
View File
@@ -17,8 +17,6 @@ public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatf
// TODO: See KT-24975 // TODO: See KT-24975
public actual val isFloat32RangeEnforced: Boolean = false public actual val isFloat32RangeEnforced: Boolean = false
public actual val supportsNamedCapturingGroup: Boolean get() = true
public actual val supportsOctalLiteralInRegex: Boolean get() = true public actual val supportsOctalLiteralInRegex: Boolean get() = true
public actual val supportsEscapeAnyCharInRegex: Boolean get() = true public actual val supportsEscapeAnyCharInRegex: Boolean get() = true