@@ -26,29 +26,35 @@ class RegexDSLTests: XCTestCase {
26
26
let regex = content ( )
27
27
for (input, maybeExpectedCaptures) in tests {
28
28
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)
35
32
}
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 {
48
36
if !xfail {
49
- XCTAssertNil ( maybeMatch, file: file, line: line)
37
+ XCTFail (
38
+ " Unexpectedly matched ' \( match) ' for ' \( input) ' " ,
39
+ file: file, line: line)
50
40
}
41
+ continue
42
+ }
43
+ if xfail {
44
+ XCTFail ( " Unexpectedly matched " , file: file, line: line)
45
+ continue
51
46
}
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)
52
58
}
53
59
}
54
60
@@ -270,10 +276,11 @@ class RegexDSLTests: XCTestCase {
270
276
}
271
277
. ignoresCase ( false )
272
278
}
273
-
279
+
280
+ // FIXME: Re-enable this test
274
281
try _testDSLCaptures (
275
282
( " 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 ) {
277
284
Capture {
278
285
OneOrMore ( . word)
279
286
Anchor . wordBoundary
@@ -289,10 +296,11 @@ class RegexDSLTests: XCTestCase {
289
296
OneOrMore ( . any, . reluctant)
290
297
" stop "
291
298
}
292
-
299
+
300
+ // FIXME: Re-enable this test
293
301
try _testDSLCaptures (
294
302
( " 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 ) {
296
304
Capture {
297
305
OneOrMore ( . word)
298
306
Anchor . wordBoundary
0 commit comments