Skip to content

Commit 348e6c3

Browse files
authored
Test for \s matching CRLF when scalar matching (#648)
1 parent 236b47c commit 348e6c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Tests/RegexTests/UTS18Tests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ extension UTS18Tests {
286286
// Test \v - vertical space
287287
lines = lineInput.matches(of: regex(#"\d{2}\v^"#).anchorsMatchLineEndings())
288288
XCTAssertEqual(lines.count, 11)
289+
// Test \s - whitespace
290+
lines = lineInput.matches(of: regex(#"\d{2}\s^"#).anchorsMatchLineEndings())
291+
XCTAssertEqual(lines.count, 11)
289292
// Test anchors as line boundaries
290293
lines = lineInput.matches(of: regex(#"^\d{2}$"#).anchorsMatchLineEndings())
291294
XCTAssertEqual(lines.count, 12)
@@ -301,6 +304,10 @@ extension UTS18Tests {
301304
lines = lineInput.matches(
302305
of: regex(#"\d{2}\v(?=\d)"#).matchingSemantics(.unicodeScalar).anchorsMatchLineEndings())
303306
XCTAssertEqual(lines.count, 10)
307+
// Unicode scalar semantics - \s matches all except for \r\n sequence
308+
lines = lineInput.matches(
309+
of: regex(#"\d{2}\s(?=\d)"#).matchingSemantics(.unicodeScalar).anchorsMatchLineEndings())
310+
XCTAssertEqual(lines.count, 10)
304311

305312
// Does not contain an empty line
306313
XCTAssertFalse(lineInput.contains(regex(#"^$"#)))

0 commit comments

Comments
 (0)