Skip to content

Commit

Permalink
[Test] More word breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
milseman committed Dec 11, 2023
1 parent 4e742b4 commit e9f21e6
Showing 1 changed file with 27 additions and 0 deletions.
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

0 comments on commit e9f21e6

Please sign in to comment.