@@ -22,6 +22,14 @@ import XCTest
22
22
@testable // for internal `matches(of:)`
23
23
import _StringProcessing
24
24
25
+ extension UnicodeScalar {
26
+ var value4Digits : String {
27
+ let valueString = String ( value, radix: 16 , uppercase: true )
28
+ if valueString. count >= 4 { return valueString }
29
+ return String ( repeating: " 0 " , count: 4 - valueString. count) + valueString
30
+ }
31
+ }
32
+
25
33
class UTS18Tests : XCTestCase {
26
34
var input : String {
27
35
" ABCdefghîøu \u{308} \u{FFF0} -–—[]123 "
@@ -293,6 +301,16 @@ extension UTS18Tests {
293
301
XCTAssertNil ( lineInput. firstMatch (
294
302
of: regex ( #"08\v^"# ) . matchingSemantics ( . unicodeScalar) . anchorsMatchLineEndings ( ) ) )
295
303
304
+ XCTAssertNotNil ( lineInput. firstMatch ( of: regex ( #"08\u{d}\u{a}"# ) . matchingSemantics ( . unicodeScalar) ) )
305
+ XCTAssertNotNil ( lineInput. firstMatch (
306
+ of: regex ( #"08..09"# ) . matchingSemantics ( . unicodeScalar) . dotMatchesNewlines ( ) ) )
307
+
308
+ for _ in 0 ..< 10 { print ( " --- " ) }
309
+ for (i, s) in lineInput. unicodeScalars. enumerated ( ) {
310
+ print ( " \( i) : scalar U+ \( s. value4Digits) " )
311
+ }
312
+ for _ in 0 ..< 10 { print ( " --- " ) }
313
+
296
314
// Does not contain an empty line
297
315
XCTAssertFalse ( lineInput. contains ( regex ( #"^$"# ) ) )
298
316
// Does contain an empty line (between \n and \r, which are reversed here)
0 commit comments