Skip to content

Commit a801234

Browse files
natecook1000hamishknight
authored andcommitted
Add a non-atomic version of a test
1 parent a0fbe9f commit a801234

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Tests/RegexTests/MatchTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,12 @@ extension RegexTests {
10991099
(input: "aa", match: "aa"),
11001100
(input: "aaa", match: nil))
11011101

1102+
// Capture behavior in non-atomic vs atomic groups
1103+
firstMatchTests(
1104+
#"(\d+)\w+\1"#,
1105+
(input: "123x12", match: "123x12"), // `\w+` matches "3x" in this case
1106+
(input: "23x23", match: "23x23"),
1107+
(input: "123x23", match: "23x23"))
11021108
firstMatchTests(
11031109
#"(?>(\d+))\w+\1"#,
11041110
(input: "123x12", match: nil))

0 commit comments

Comments
 (0)