Skip to content

Commit 3bd6b8b

Browse files
committed
Statically enforce type equivalence for _testDSLCaptures
1 parent 104b815 commit 3bd6b8b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RegexDSLTests: XCTestCase {
2222
file: StaticString = #file,
2323
line: UInt = #line,
2424
@RegexComponentBuilder _ content: () -> Content
25-
) throws {
25+
) throws where Content.RegexOutput == MatchType {
2626
let regex = content()
2727
for (input, maybeExpectedCaptures) in tests {
2828
let maybeMatch = input.wholeMatch(of: regex)
@@ -44,13 +44,7 @@ class RegexDSLTests: XCTestCase {
4444
XCTFail("Unexpectedly matched", file: file, line: line)
4545
continue
4646
}
47-
XCTAssertTrue(
48-
type(of: regex).RegexOutput.self == MatchType.self,
49-
"""
50-
Expected match type: \(MatchType.self)
51-
Actual match type: \(type(of: regex).RegexOutput.self)
52-
""")
53-
let captures = try XCTUnwrap(match.output as? MatchType, file: file, line: line)
47+
let captures = match.output
5448
XCTAssertTrue(
5549
equivalence(captures, expectedCaptures),
5650
"'\(captures)' is not equal to the expected '\(expectedCaptures)'.",

0 commit comments

Comments
 (0)