We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4665622 + 17d8362 commit 18f2d61Copy full SHA for 18f2d61
Tests/RegexBuilderTests/RegexDSLTests.swift
@@ -525,6 +525,29 @@ class RegexDSLTests: XCTestCase {
525
*/
526
}
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
541
+ ("aaaa1", ("aaaa1", "a")),
542
+ matchType: (Substring, Substring??).self, ==)
543
544
+ ZeroOrMore {
545
+ Capture("a", transform: { Optional.some($0) })
546
547
548
549
550
+
551
func testCapturelessQuantification() throws {
552
// This test is to make sure that a captureless quantification, when used
553
// straight out of the quantifier (without being wrapped in a builder), is
0 commit comments