Skip to content

Commit

Permalink
Expand variadic compilation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
natecook1000 committed Mar 9, 2024
1 parent 9430a76 commit ef5dbd4
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions Tests/RegexBuilderTests/RegexDSLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,78 @@ extension RegexDSLTests {
XCTAssertEqual(match.output.2, "b")
XCTAssertNil(match.output.3)
}

func testVariadicNesting_Compilation() {
let regex2_1 = Regex {
"a"
Optionally {
Capture { "b" }
}
}
let _: Regex<(Substring, Substring?)> = regex2_1

let regex2_2 = Regex {
"a"
Optionally {
Capture { "b" }
Capture { "c" }
}
}
let _: Regex<(Substring, Substring?, Substring?)> = regex2_2

let regex3_1 = Regex {
Optionally {
regex2_1
}
}
let _: Regex<(Substring, Substring??)> = regex3_1

let regex3_2 = Regex {
Optionally {
regex2_2
}
}
let _: Regex<(Substring, Substring??, Substring??)> = regex3_2

let regex3_1_1 = Regex {
Optionally {
regex2_1
regex2_1
}
}
let _: Regex<(Substring, Substring??, Substring??)> = regex3_1_1

let regex3_2_1 = Regex {
Optionally {
regex2_2
regex2_1
}
}
let _: Regex<(Substring, Substring??, Substring??, Substring??)> = regex3_2_1

let regex3_2_2 = Regex {
Optionally {
regex2_2
regex2_2
}
}
let _: Regex<(Substring, Substring??, Substring??, Substring??, Substring??)> = regex3_2_2

let regexChoices = Regex {
ChoiceOf {
Capture { "A" }
"b"
"c"
Capture { "D" }
Optionally {
Capture {
"E"
}
}
}
}
let _: Regex<(Substring, Substring?, Substring?, Substring??)> = regexChoices
}
}

extension Unicode.Scalar {
Expand Down

0 comments on commit ef5dbd4

Please sign in to comment.