Test backreference to group with index zero
This commit is contained in:
committed by
Space
parent
74121b26c0
commit
187faa121e
@@ -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
|
||||
}
|
||||
@@ -36,4 +36,5 @@ public expect object BackReferenceHandling {
|
||||
val enclosingGroup: HandlingOption
|
||||
val nonExistentGroup: HandlingOption
|
||||
val nonExistentNamedGroup: HandlingOption
|
||||
val groupZero: HandlingOption
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user