File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -525,6 +525,29 @@ class RegexDSLTests: XCTestCase {
525
525
*/
526
526
}
527
527
528
+ func testCaptureTransform( ) throws {
529
+ try _testDSLCaptures (
530
+ ( " aaaa1 " , ( " aaaa1 " , " aaa " ) ) ,
531
+ matchType: ( Substring, Substring) . self, == )
532
+ {
533
+ Capture {
534
+ OneOrMore ( " a " )
535
+ } transform: {
536
+ $0. dropFirst ( )
537
+ }
538
+ One ( . digit)
539
+ }
540
+ try _testDSLCaptures (
541
+ ( " aaaa1 " , ( " aaaa1 " , " a " ) ) ,
542
+ matchType: ( Substring, Substring?? ) . self, == )
543
+ {
544
+ ZeroOrMore {
545
+ Capture ( " a " , transform: { Optional . some ( $0) } )
546
+ }
547
+ One ( . digit)
548
+ }
549
+ }
550
+
528
551
func testCapturelessQuantification( ) throws {
529
552
// This test is to make sure that a captureless quantification, when used
530
553
// straight out of the quantifier (without being wrapped in a builder), is
You can’t perform that action at this time.
0 commit comments