Skip to content

Commit 179d8e7

Browse files
committed
Add test cases
1 parent 216eee0 commit 179d8e7

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

Tests/RegexTests/MatchTests.swift

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,33 +1629,36 @@ extension RegexTests {
16291629
#"\d{3}(?<!USD\d{3})"#, input: "Price: JYP100", match: "100")
16301630

16311631
firstMatchTest(#"(?<=abc)def"#, input: "abcdefg", match: "def")
1632-
firstMatchTests(
1633-
#"(?<=az|b|c)def"#,
1634-
("azdefg", "def"),
1635-
("bdefg", "def"),
1636-
("cdefg", "def"),
1637-
("123defg", nil),
1638-
validateOptimizations: false
1639-
)
1640-
1641-
firstMatchTest(#"abcd(?<=bc(?=d).)"#, input: "abcdefg", match: "abcd")
1632+
firstMatchTests(
1633+
#"(?<=az|b|c)def"#,
1634+
("azdefg", "def"),
1635+
("bdefg", "def"),
1636+
("cdefg", "def"),
1637+
("123defg", nil)
1638+
)
16421639

16431640
// FIXME: quickMatch and thoroughMatch have different results
16441641
// firstMatchTest(
16451642
// #"(?<=\d{1,3}-.{1,3}-\d{1,3})suffix"#,
16461643
// input: "123-_+/-789suffix",
1647-
// match: "suffix",
1648-
// validateOptimizations: false
1644+
// match: "suffix"
16491645
// )
16501646

1651-
firstMatchTests(
1652-
#"(?<=^\d{1,3})abc"#,
1653-
("123abc", "abc"),
1654-
("12abc", "abc"),
1655-
("1abc", "abc"),
1656-
("1234abc", nil), // FIXME: Shouldn't match but does because `^` assertions are broken
1657-
("z123abc", nil) // FIXME: Same as above
1658-
)
1647+
firstMatchTests(
1648+
#"(?<=^\d{1,3})abc"#,
1649+
("123abc", "abc"),
1650+
("12abc", "abc"),
1651+
("1abc", "abc"),
1652+
("1234abc", nil), // FIXME: Shouldn't match but does because `^` assertions are broken
1653+
("z123abc", nil) // FIXME: Same as above
1654+
)
1655+
1656+
firstMatchTest(#"abcd(?<=c(?=d)d)"#, input: "abcdefg", match: "abcd")
1657+
firstMatchTest(#"abcd(?<=cd(?=d).)"#, input: "abcdefg", match: nil)
1658+
firstMatchTest(#"abcd(?<=c(?=e)d)"#, input: "abcdefg", match: nil)
1659+
firstMatchTest(#"abcd(?<=bc(?=d).)"#, input: "abcdefg", match: "abcd")
1660+
firstMatchTest(#"abcd(?<=bc(?=de)d)"#, input: "abcdefg", match: "abcd")
1661+
firstMatchTest(#"abcd(?<=bc(?=de).)"#, input: "abcdefg", match: "abcd")
16591662
}
16601663

16611664
func testMatchAnchors() throws {

0 commit comments

Comments
 (0)