@@ -26,29 +26,35 @@ class RegexDSLTests: XCTestCase {
2626 let regex = content ( )
2727 for (input, maybeExpectedCaptures) in tests {
2828 let maybeMatch = input. wholeMatch ( of: regex)
29- if let expectedCaptures = maybeExpectedCaptures,
30- let match = maybeMatch
31- {
32- if xfail {
33- XCTFail ( " Unexpectedly matched " , file: file, line: line)
34- continue
29+ guard let match = maybeMatch else {
30+ if !xfail, maybeExpectedCaptures != nil {
31+ XCTFail ( " Failed to match ' \( input) ' " , file: file, line: line)
3532 }
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)
43- XCTAssertTrue (
44- equivalence ( captures, expectedCaptures) ,
45- " ' \( captures) ' is not equal to the expected ' \( expectedCaptures) '. " ,
46- file: file, line: line)
47- } else {
33+ continue
34+ }
35+ guard let expectedCaptures = maybeExpectedCaptures else {
4836 if !xfail {
49- XCTAssertNil ( maybeMatch, file: file, line: line)
37+ XCTFail (
38+ " Unexpectedly matched ' \( match) ' for ' \( input) ' " ,
39+ file: file, line: line)
5040 }
41+ continue
42+ }
43+ if xfail {
44+ XCTFail ( " Unexpectedly matched " , file: file, line: line)
45+ continue
5146 }
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)
54+ XCTAssertTrue (
55+ equivalence ( captures, expectedCaptures) ,
56+ " ' \( captures) ' is not equal to the expected ' \( expectedCaptures) '. " ,
57+ file: file, line: line)
5258 }
5359 }
5460
@@ -270,10 +276,11 @@ class RegexDSLTests: XCTestCase {
270276 }
271277 . ignoresCase ( false )
272278 }
273-
279+
280+ // FIXME: Re-enable this test
274281 try _testDSLCaptures (
275282 ( " can't stop won't stop " , ( " can't stop won't stop " , " can't " , " won't " ) ) ,
276- matchType: ( Substring, Substring, Substring) . self, == ) {
283+ matchType: ( Substring, Substring, Substring) . self, == , xfail : true ) {
277284 Capture {
278285 OneOrMore ( . word)
279286 Anchor . wordBoundary
@@ -289,10 +296,11 @@ class RegexDSLTests: XCTestCase {
289296 OneOrMore ( . any, . reluctant)
290297 " stop "
291298 }
292-
299+
300+ // FIXME: Re-enable this test
293301 try _testDSLCaptures (
294302 ( " can't stop won't stop " , ( " can't stop won't stop " , " can " , " won " ) ) ,
295- matchType: ( Substring, Substring, Substring) . self, == ) {
303+ matchType: ( Substring, Substring, Substring) . self, == , xfail : true ) {
296304 Capture {
297305 OneOrMore ( . word)
298306 Anchor . wordBoundary
0 commit comments