@@ -1211,22 +1211,41 @@ class TestNSString : XCTestCase {
1211
1211
}
1212
1212
1213
1213
struct ComparisonTest {
1214
+ enum TestBehavior {
1215
+ case run
1216
+ case xfail( String )
1217
+ case skip( String )
1218
+ }
1214
1219
let lhs : String
1215
1220
let rhs : String
1216
1221
let loc : UInt
1217
- let reason : String
1222
+ let behavior : TestBehavior
1218
1223
1219
1224
var xfail : Bool {
1220
- return !reason. isEmpty
1225
+ if case let Behavior . xfail( _) = behavior {
1226
+ return true
1227
+ } else {
1228
+ return false
1229
+ }
1221
1230
}
1222
1231
1223
1232
init (
1224
1233
_ lhs: String , _ rhs: String ,
1225
- reason: String = " " , line: UInt = #line
1234
+ xfail reason: String = " " , line: UInt = #line
1235
+ ) {
1236
+ self . lhs = lhs
1237
+ self . rhs = rhs
1238
+ self . behavior = xfail. isEmpty ? . run : . xfail( reason)
1239
+ self . loc = line
1240
+ }
1241
+
1242
+ init (
1243
+ _ lhs: String , _ rhs: String ,
1244
+ skip reason: String = " " , line: UInt = #line
1226
1245
) {
1227
1246
self . lhs = lhs
1228
1247
self . rhs = rhs
1229
- self . reason = reason
1248
+ self . behavior = skip . isEmpty ? . run : . skip ( reason)
1230
1249
self . loc = line
1231
1250
}
1232
1251
}
@@ -1238,14 +1257,15 @@ let comparisonTests = [
1238
1257
// ASCII cases
1239
1258
ComparisonTest ( " t " , " tt " ) ,
1240
1259
ComparisonTest ( " t " , " Tt " ) ,
1241
- ComparisonTest ( " \u{0} " , " " ) ,
1260
+ ComparisonTest ( " \u{0} " , " " ,
1261
+ skip: " rdar://problem/37686816 " ) ,
1242
1262
ComparisonTest ( " \u{0} " , " \u{0} " ,
1243
- reason : " https://bugs.swift.org/browse/SR-332 " ) ,
1263
+ xfail : " https://bugs.swift.org/browse/SR-332 " ) ,
1244
1264
ComparisonTest ( " \r \n " , " t " ) ,
1245
1265
ComparisonTest ( " \r \n " , " \n " ,
1246
- reason : " blocked on rdar://problem/19036555 " ) ,
1266
+ xfail : " blocked on rdar://problem/19036555 " ) ,
1247
1267
ComparisonTest ( " \u{0} " , " \u{0} \u{0} " ,
1248
- reason : " rdar://problem/19034601 " ) ,
1268
+ xfail : " rdar://problem/19034601 " ) ,
1249
1269
1250
1270
// Whitespace
1251
1271
// U+000A LINE FEED (LF)
@@ -1309,7 +1329,7 @@ let comparisonTests = [
1309
1329
// U+1F1E7 REGIONAL INDICATOR SYMBOL LETTER B
1310
1330
// \u{1F1E7}\u{1F1E7} Flag of Barbados
1311
1331
ComparisonTest ( " \u{1F1E7} " , " \u{1F1E7} \u{1F1E7} " ,
1312
- reason : " https://bugs.swift.org/browse/SR-367 " ) ,
1332
+ xfail : " https://bugs.swift.org/browse/SR-367 " ) ,
1313
1333
1314
1334
// Test that Unicode collation is performed in deterministic mode.
1315
1335
//
@@ -1325,7 +1345,7 @@ let comparisonTests = [
1325
1345
// U+0301 and U+0954 don't decompose in the canonical decomposition mapping.
1326
1346
// U+0341 has a canonical decomposition mapping of U+0301.
1327
1347
ComparisonTest ( " \u{0301} " , " \u{0341} " ,
1328
- reason : " https://bugs.swift.org/browse/SR-243 " ) ,
1348
+ xfail : " https://bugs.swift.org/browse/SR-243 " ) ,
1329
1349
ComparisonTest ( " \u{0301} " , " \u{0954} " ) ,
1330
1350
ComparisonTest ( " \u{0341} " , " \u{0954} " ) ,
1331
1351
]
@@ -1385,6 +1405,10 @@ func checkHasPrefixHasSuffix(_ lhs: String, _ rhs: String, _ stack: [UInt]) -> I
1385
1405
extension TestNSString {
1386
1406
func test_PrefixSuffix( ) {
1387
1407
for test in comparisonTests {
1408
+ if case let ComparisonTest . Behavior . skip( _) = test. behavior {
1409
+ continue
1410
+ }
1411
+
1388
1412
var failures = 0
1389
1413
failures += checkHasPrefixHasSuffix ( test. lhs, test. rhs, [ test. loc, #line] )
1390
1414
failures += checkHasPrefixHasSuffix ( test. rhs, test. lhs, [ test. loc, #line] )
0 commit comments