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 @@ -224,6 +224,30 @@ class RegexDSLTests: XCTestCase {
224224 } . matchingSemantics ( . unicodeScalar) . asciiOnlyWhitespace ( asciiOnly)
225225 }
226226 }
227+
228+ // Make sure horizontal whitespace does not match newlines or other
229+ // vertical whitespace.
230+ try _testDSLCaptures (
231+ ( " \u{A0} \u{9} \t " , " \u{A0} \u{9} \t " ) ,
232+ ( " \n " , nil ) ,
233+ ( " \r " , nil ) ,
234+ ( " \r \n " , nil ) ,
235+ ( " \u{2028} " , nil ) ,
236+ matchType: Substring . self, == )
237+ {
238+ OneOrMore ( . horizontalWhitespace)
239+ }
240+
241+ // Horizontal whitespace in ASCII mode.
242+ try _testDSLCaptures (
243+ ( " \u{9} \t " , " \u{9} \t " ) ,
244+ ( " \u{A0} " , nil ) ,
245+ matchType: Substring . self, == )
246+ {
247+ Regex {
248+ OneOrMore ( . horizontalWhitespace)
249+ } . asciiOnlyWhitespace ( )
250+ }
227251 }
228252
229253 func testCharacterClassOperations( ) throws {
You can’t perform that action at this time.
0 commit comments