Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] word breaking test case #703

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
@@ -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 }