diff --git a/kotlin-native/backend.native/tests/stdlib_external/utils.kt b/kotlin-native/backend.native/tests/stdlib_external/utils.kt index cebad086d7e..1eb6826d3c1 100644 --- a/kotlin-native/backend.native/tests/stdlib_external/utils.kt +++ b/kotlin-native/backend.native/tests/stdlib_external/utils.kt @@ -44,4 +44,5 @@ public actual object BackReferenceHandling { actual val enclosingGroup: HandlingOption = HandlingOption.MATCH_NOTHING actual val nonExistentGroup: HandlingOption = HandlingOption.THROW actual val nonExistentNamedGroup: HandlingOption = HandlingOption.THROW + actual val groupZero: HandlingOption = HandlingOption.THROW } \ No newline at end of file diff --git a/libraries/stdlib/common/test/testUtils.kt b/libraries/stdlib/common/test/testUtils.kt index 7acc2608c26..856eb4769ea 100644 --- a/libraries/stdlib/common/test/testUtils.kt +++ b/libraries/stdlib/common/test/testUtils.kt @@ -36,4 +36,5 @@ public expect object BackReferenceHandling { val enclosingGroup: HandlingOption val nonExistentGroup: HandlingOption val nonExistentNamedGroup: HandlingOption + val groupZero: HandlingOption } \ No newline at end of file diff --git a/libraries/stdlib/js/test/core/testUtils.kt b/libraries/stdlib/js/test/core/testUtils.kt index 0791b9aa6ae..e53b7fe6a79 100644 --- a/libraries/stdlib/js/test/core/testUtils.kt +++ b/libraries/stdlib/js/test/core/testUtils.kt @@ -41,4 +41,5 @@ public actual object BackReferenceHandling { actual val enclosingGroup: HandlingOption = HandlingOption.IGNORE_BACK_REFERENCE_EXPRESSION actual val nonExistentGroup: HandlingOption = HandlingOption.THROW actual val nonExistentNamedGroup: HandlingOption = HandlingOption.THROW + actual val groupZero: HandlingOption = HandlingOption.MATCH_NOTHING } \ No newline at end of file diff --git a/libraries/stdlib/jvm/test/testUtilsJVM.kt b/libraries/stdlib/jvm/test/testUtilsJVM.kt index 4e6a6fbf77c..43e1fe1c148 100644 --- a/libraries/stdlib/jvm/test/testUtilsJVM.kt +++ b/libraries/stdlib/jvm/test/testUtilsJVM.kt @@ -55,4 +55,5 @@ public actual object BackReferenceHandling { actual val enclosingGroup: HandlingOption = HandlingOption.MATCH_NOTHING actual val nonExistentGroup: HandlingOption = HandlingOption.MATCH_NOTHING actual val nonExistentNamedGroup: HandlingOption = HandlingOption.THROW + actual val groupZero: HandlingOption = HandlingOption.THROW } \ No newline at end of file diff --git a/libraries/stdlib/test/text/RegexTest.kt b/libraries/stdlib/test/text/RegexTest.kt index d2ca64dc57c..d91a6f4fa93 100644 --- a/libraries/stdlib/test/text/RegexTest.kt +++ b/libraries/stdlib/test/text/RegexTest.kt @@ -241,6 +241,9 @@ class RegexTest { testInvalidBackReference(BackReferenceHandling.nonExistentGroup, pattern = "a(a)\\2") testInvalidBackReference(BackReferenceHandling.enclosingGroup, pattern = "a(a\\1)") testInvalidBackReference(BackReferenceHandling.notYetDefinedGroup, pattern = "a\\1(a)") + + testInvalidBackReference(BackReferenceHandling.groupZero, pattern = "aa\\0") + testInvalidBackReference(BackReferenceHandling.groupZero, pattern = "a\\0a") } @Test fun matchCharWithOctalValue() { @@ -306,7 +309,7 @@ class RegexTest { // TODO: Test comment mode enabled and group name is separated by space, (before, in the middle, after) // TODO: Test comment mode enabled and back reference group index is separated by space, (before, in the middle, after) - // TODO: Test back reference with \0 + // TODO: IllegalArgumentException to java.util.regex.PatternSyntaxException where possible @Test fun matchMultiline() { val regex = "^[a-z]*$".toRegex(setOf(RegexOption.IGNORE_CASE, RegexOption.MULTILINE)) diff --git a/libraries/stdlib/wasm/test/testUtils.kt b/libraries/stdlib/wasm/test/testUtils.kt index 7d02483e5de..ef5c81dbc7f 100644 --- a/libraries/stdlib/wasm/test/testUtils.kt +++ b/libraries/stdlib/wasm/test/testUtils.kt @@ -42,4 +42,5 @@ public actual object BackReferenceHandling { actual val enclosingGroup: HandlingOption = HandlingOption.MATCH_NOTHING actual val nonExistentGroup: HandlingOption = HandlingOption.THROW actual val nonExistentNamedGroup: HandlingOption = HandlingOption.THROW + actual val groupZero: HandlingOption = HandlingOption.THROW } \ No newline at end of file