Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Tests/RegexTests/MatchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down