@@ -1274,81 +1274,81 @@ VIDEOS=StopgapVideos
1274
1274
XCTAssertNil ( NSHomeDirectoryForUser ( " " ) )
1275
1275
1276
1276
XCTAssertThrowsError ( try fm. contentsOfDirectory ( atPath: " " ) ) {
1277
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1277
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1278
1278
XCTAssertEqual ( code, . fileReadInvalidFileName)
1279
1279
}
1280
1280
1281
1281
XCTAssertNil ( fm. enumerator ( atPath: " " ) )
1282
1282
XCTAssertNil ( fm. subpaths ( atPath: " " ) )
1283
1283
XCTAssertThrowsError ( try fm. subpathsOfDirectory ( atPath: " " ) ) {
1284
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1284
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1285
1285
XCTAssertEqual ( code, . fileReadInvalidFileName)
1286
1286
}
1287
1287
1288
1288
XCTAssertThrowsError ( try fm. createDirectory ( atPath: " " , withIntermediateDirectories: true ) ) {
1289
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1289
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1290
1290
XCTAssertEqual ( code, . fileReadInvalidFileName)
1291
1291
}
1292
1292
XCTAssertFalse ( fm. createFile ( atPath: " " , contents: Data ( ) ) )
1293
1293
XCTAssertThrowsError ( try fm. removeItem ( atPath: " " ) ) {
1294
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1294
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1295
1295
XCTAssertEqual ( code, . fileReadInvalidFileName)
1296
1296
}
1297
1297
1298
1298
XCTAssertThrowsError ( try fm. copyItem ( atPath: " " , toPath: " /tmp/t " ) ) {
1299
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1299
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1300
1300
XCTAssertEqual ( code, . fileReadInvalidFileName)
1301
1301
}
1302
1302
XCTAssertThrowsError ( try fm. copyItem ( atPath: " " , toPath: " " ) ) {
1303
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1303
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1304
1304
XCTAssertEqual ( code, . fileReadInvalidFileName)
1305
1305
}
1306
1306
XCTAssertThrowsError ( try fm. copyItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1307
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1307
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1308
1308
XCTAssertEqual ( code, . fileReadNoSuchFile)
1309
1309
}
1310
1310
1311
1311
XCTAssertThrowsError ( try fm. moveItem ( atPath: " " , toPath: " /tmp/t " ) ) {
1312
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1312
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1313
1313
XCTAssertEqual ( code, . fileReadInvalidFileName)
1314
1314
}
1315
1315
XCTAssertThrowsError ( try fm. moveItem ( atPath: " " , toPath: " " ) ) {
1316
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1316
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1317
1317
XCTAssertEqual ( code, . fileReadInvalidFileName)
1318
1318
}
1319
1319
XCTAssertThrowsError ( try fm. moveItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1320
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1320
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1321
1321
XCTAssertEqual ( code, . fileReadInvalidFileName)
1322
1322
}
1323
1323
1324
1324
XCTAssertThrowsError ( try fm. linkItem ( atPath: " " , toPath: " /tmp/t " ) ) {
1325
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1325
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1326
1326
XCTAssertEqual ( code, . fileReadInvalidFileName)
1327
1327
}
1328
1328
XCTAssertThrowsError ( try fm. linkItem ( atPath: " " , toPath: " " ) ) {
1329
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1329
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1330
1330
XCTAssertEqual ( code, . fileReadInvalidFileName)
1331
1331
}
1332
1332
XCTAssertThrowsError ( try fm. linkItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1333
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1333
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1334
1334
XCTAssertEqual ( code, . fileReadNoSuchFile)
1335
1335
}
1336
1336
1337
1337
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " " , withDestinationPath: " " ) ) {
1338
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1338
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1339
1339
XCTAssertEqual ( code, . fileReadInvalidFileName)
1340
1340
}
1341
1341
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " " , withDestinationPath: " /tmp/t " ) ) {
1342
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1342
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1343
1343
XCTAssertEqual ( code, . fileReadInvalidFileName)
1344
1344
}
1345
1345
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " /tmp/t " , withDestinationPath: " " ) ) {
1346
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1346
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1347
1347
XCTAssertEqual ( code, . fileReadInvalidFileName)
1348
1348
}
1349
1349
1350
1350
XCTAssertThrowsError ( try fm. destinationOfSymbolicLink ( atPath: " " ) ) {
1351
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1351
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1352
1352
XCTAssertEqual ( code, . fileReadInvalidFileName)
1353
1353
}
1354
1354
XCTAssertFalse ( fm. fileExists ( atPath: " " ) )
@@ -1359,15 +1359,15 @@ VIDEOS=StopgapVideos
1359
1359
XCTAssertTrue ( fm. isDeletableFile ( atPath: " " ) )
1360
1360
1361
1361
XCTAssertThrowsError ( try fm. attributesOfItem ( atPath: " " ) ) {
1362
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1362
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1363
1363
XCTAssertEqual ( code, . fileReadInvalidFileName)
1364
1364
}
1365
1365
XCTAssertThrowsError ( try fm. attributesOfFileSystem ( forPath: " " ) ) {
1366
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1366
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1367
1367
XCTAssertEqual ( code, . fileReadInvalidFileName)
1368
1368
}
1369
1369
XCTAssertThrowsError ( try fm. setAttributes ( [ : ] , ofItemAtPath: " " ) ) {
1370
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1370
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1371
1371
XCTAssertEqual ( code, . fileReadInvalidFileName)
1372
1372
}
1373
1373
0 commit comments