Skip to content

Commit a8f7ee9

Browse files
committed
Minor test improvements
1 parent f838794 commit a8f7ee9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Tests/RegexTests/LiteralPrinterTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ extension RegexTests {
4141
}
4242

4343
func testUnicodeEscapes() throws {
44+
let regex0 = #/[a]\u0301/#
45+
_literalTest(regex0, expected: #"[a]\u0301"#)
46+
4447
let regex = #/\r\n\t cafe\u{301} \u{1D11E}/#
4548
_literalTest(regex, expected: #"\r\n\t cafe\u0301 \U0001D11E"#)
4649
}

Tests/RegexTests/MatchTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ struct MatchError: Error {
2626
@available(SwiftStdlib 6.0, *)
2727
func _roundTripLiteral(
2828
_ regexStr: String,
29-
syntax: SyntaxOptions
29+
syntax: SyntaxOptions,
30+
file: StaticString = #file,
31+
line: UInt = #line
3032
) throws -> Regex<AnyRegexOutput>? {
3133
guard let pattern = try Regex(regexStr, syntax: syntax)._literalPattern else {
3234
return nil
3335
}
3436

3537
let remadeRegex = try Regex(pattern)
36-
XCTAssertEqual(pattern, remadeRegex._literalPattern)
38+
XCTAssertEqual(pattern, remadeRegex._literalPattern, file: file, line: line)
3739
return remadeRegex
3840
}
3941

@@ -91,7 +93,7 @@ func _firstMatch(
9193
}
9294

9395
if #available(SwiftStdlib 6.0, *) {
94-
let roundTripRegex = try? _roundTripLiteral(regexStr, syntax: syntax)
96+
let roundTripRegex = try? _roundTripLiteral(regexStr, syntax: syntax, file: file, line: line)
9597
let roundTripResult = try? roundTripRegex?
9698
.matchingSemantics(semanticLevel)
9799
.firstMatch(in: input)?[0]

0 commit comments

Comments
 (0)