Skip to content

Commit 435435d

Browse files
committed
Statically enforce type equivalence for _testDSLCaptures
1 parent bdf9a60 commit 435435d

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)
@@ -33,13 +33,7 @@ class RegexDSLTests: XCTestCase {
3333
XCTFail("Unexpectedly matched", file: file, line: line)
3434
continue
3535
}
36-
XCTAssertTrue(
37-
type(of: regex).RegexOutput.self == MatchType.self,
38-
"""
39-
Expected match type: \(MatchType.self)
40-
Actual match type: \(type(of: regex).RegexOutput.self)
41-
""")
42-
let captures = try XCTUnwrap(match.output as? MatchType, file: file, line: line)
36+
let captures = match.output
4337
XCTAssertTrue(
4438
equivalence(captures, expectedCaptures),
4539
"'\(captures)' is not equal to the expected '\(expectedCaptures)'.",

0 commit comments

Comments
 (0)