[K/N and WASM] Throw on duplicate group name
This commit is contained in:
committed by
Space
parent
187faa121e
commit
9593069cb3
@@ -174,6 +174,17 @@ class RegexTest {
|
||||
assertEquals("123", namedGroups["areaCode"]?.value)
|
||||
}
|
||||
|
||||
@Test fun matchDuplicateGroupName() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
"(?<hi>hi)|(?<hi>bye)".toRegex()
|
||||
}
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
Regex("(?<first>\\d+)-(?<first>\\d+)")
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun matchOptionalNamedGroup() {
|
||||
if (!supportsNamedCapturingGroup) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user