From e9f21e6beea71c5d478316dd0edc418fa2f5e442 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Sun, 10 Dec 2023 10:03:30 -0700 Subject: [PATCH] [Test] More word breaking tests --- Tests/RegexTests/MatchTests.swift | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Tests/RegexTests/MatchTests.swift b/Tests/RegexTests/MatchTests.swift index ea59cbc5c..eb48b432c 100644 --- a/Tests/RegexTests/MatchTests.swift +++ b/Tests/RegexTests/MatchTests.swift @@ -1683,6 +1683,33 @@ extension RegexTests { firstMatchTest(#"\b÷\b"#, input: "3 ÷ 3 = 1", match: "÷") } + func testLevel2WordBoundaries_negative() throws { + // Run some non-match cases, the latter of which used to hang + + // FIXME: stdlib 5.10 check + + let re = #"\bA\b"# + + firstMatchTest(re, input: "⛔️: X ", match: nil) + firstMatchTest(re, input: "日\u{FE0F}: X ", match: nil) + firstMatchTest(re, input: "👨‍👨‍👧‍👦\u{FE0F}: X ", match: nil) + + firstMatchTest(re, input: "Z:X ", match: nil) + + firstMatchTest(re, input: "Z\u{FE0F}:X ", match: nil) + firstMatchTest(re, input: "è\u{FE0F}:X ", match: nil) + + firstMatchTest(re, input: "日:X ", match: nil) + firstMatchTest(re, input: "👨‍👨‍👧‍👦:X ", match: nil) + + firstMatchTest(re, input: "日\u{FE0F}:X ", match: nil) + firstMatchTest(re, input: "👨‍👨‍👧‍👦\u{FE0F}:X ", match: nil) + firstMatchTest(re, input: "⛔️:X ", match: nil) + + firstMatchTest(re, input: "⛔️·X ", match: nil) + firstMatchTest(re, input: "⛔️:X ", match: nil) + } + func testMatchGroups() { // Must have new stdlib for character class ranges and word boundaries. guard ensureNewStdlib() else { return }