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 @@ -259,6 +259,34 @@ class RegexDSLTests: XCTestCase {
259259 } . dotMatchesNewlines ( dotMatchesNewline)
260260 }
261261 }
262+
263+ // `.anyGraphemeCluster` is the same as `.any` in grapheme mode.
264+ for mode in [ RegexSemanticLevel . graphemeCluster, . unicodeScalar] {
265+ try _testDSLCaptures (
266+ ( " a " , " a " ) ,
267+ ( " \r \n " , " \r \n " ) ,
268+ ( " e \u{301} " , " e \u{301} " ) ,
269+ ( " e \u{301} f " , nil ) ,
270+ ( " e \u{303} \u{301} \u{302} " , " e \u{303} \u{301} \u{302} " ) ,
271+ matchType: Substring . self, == )
272+ {
273+ Regex {
274+ One ( . anyGraphemeCluster)
275+ } . matchingSemantics ( mode)
276+ }
277+
278+ // Like `.any` it also always matches newlines.
279+ for dotMatchesNewline in [ true , false ] {
280+ try _testDSLCaptures (
281+ ( " abc \( allNewlines) def " , " abc \( allNewlines) def " ) ,
282+ matchType: Substring . self, == )
283+ {
284+ Regex {
285+ OneOrMore ( . anyGraphemeCluster)
286+ } . matchingSemantics ( mode) . dotMatchesNewlines ( dotMatchesNewline)
287+ }
288+ }
289+ }
262290 }
263291
264292 func testMatchResultDotZeroWithoutCapture( ) throws {
You can’t perform that action at this time.
0 commit comments