File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,30 @@ class RegexDSLTests: XCTestCase {
220
220
} . matchingSemantics ( . unicodeScalar) . asciiOnlyWhitespace ( asciiOnly)
221
221
}
222
222
}
223
+
224
+ // Make sure horizontal whitespace does not match newlines or other
225
+ // vertical whitespace.
226
+ try _testDSLCaptures (
227
+ ( " \u{A0} \u{9} \t " , " \u{A0} \u{9} \t " ) ,
228
+ ( " \n " , nil ) ,
229
+ ( " \r " , nil ) ,
230
+ ( " \r \n " , nil ) ,
231
+ ( " \u{2028} " , nil ) ,
232
+ matchType: Substring . self, == )
233
+ {
234
+ OneOrMore ( . horizontalWhitespace)
235
+ }
236
+
237
+ // Horizontal whitespace in ASCII mode.
238
+ try _testDSLCaptures (
239
+ ( " \u{9} \t " , " \u{9} \t " ) ,
240
+ ( " \u{A0} " , nil ) ,
241
+ matchType: Substring . self, == )
242
+ {
243
+ Regex {
244
+ OneOrMore ( . horizontalWhitespace)
245
+ } . asciiOnlyWhitespace ( )
246
+ }
223
247
}
224
248
225
249
func testCharacterClassOperations( ) throws {
You can’t perform that action at this time.
0 commit comments