File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,34 @@ class RegexDSLTests: XCTestCase {
255
255
} . dotMatchesNewlines ( dotMatchesNewline)
256
256
}
257
257
}
258
+
259
+ // `.anyGraphemeCluster` is the same as `.any` in grapheme mode.
260
+ for mode in [ RegexSemanticLevel . graphemeCluster, . unicodeScalar] {
261
+ try _testDSLCaptures (
262
+ ( " a " , " a " ) ,
263
+ ( " \r \n " , " \r \n " ) ,
264
+ ( " e \u{301} " , " e \u{301} " ) ,
265
+ ( " e \u{301} f " , nil ) ,
266
+ ( " e \u{303} \u{301} \u{302} " , " e \u{303} \u{301} \u{302} " ) ,
267
+ matchType: Substring . self, == )
268
+ {
269
+ Regex {
270
+ One ( . anyGraphemeCluster)
271
+ } . matchingSemantics ( mode)
272
+ }
273
+
274
+ // Like `.any` it also always matches newlines.
275
+ for dotMatchesNewline in [ true , false ] {
276
+ try _testDSLCaptures (
277
+ ( " abc \( allNewlines) def " , " abc \( allNewlines) def " ) ,
278
+ matchType: Substring . self, == )
279
+ {
280
+ Regex {
281
+ OneOrMore ( . anyGraphemeCluster)
282
+ } . matchingSemantics ( mode) . dotMatchesNewlines ( dotMatchesNewline)
283
+ }
284
+ }
285
+ }
258
286
}
259
287
260
288
func testMatchResultDotZeroWithoutCapture( ) throws {
You can’t perform that action at this time.
0 commit comments