@@ -1321,81 +1321,81 @@ VIDEOS=StopgapVideos
1321
1321
XCTAssertNil ( NSHomeDirectoryForUser ( " " ) )
1322
1322
1323
1323
XCTAssertThrowsError ( try fm. contentsOfDirectory ( atPath: " " ) ) {
1324
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1324
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1325
1325
XCTAssertEqual ( code, . fileReadInvalidFileName)
1326
1326
}
1327
1327
1328
1328
XCTAssertNil ( fm. enumerator ( atPath: " " ) )
1329
1329
XCTAssertNil ( fm. subpaths ( atPath: " " ) )
1330
1330
XCTAssertThrowsError ( try fm. subpathsOfDirectory ( atPath: " " ) ) {
1331
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1331
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1332
1332
XCTAssertEqual ( code, . fileReadInvalidFileName)
1333
1333
}
1334
1334
1335
1335
XCTAssertThrowsError ( try fm. createDirectory ( atPath: " " , withIntermediateDirectories: true ) ) {
1336
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1336
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1337
1337
XCTAssertEqual ( code, . fileReadInvalidFileName)
1338
1338
}
1339
1339
XCTAssertFalse ( fm. createFile ( atPath: " " , contents: Data ( ) ) )
1340
1340
XCTAssertThrowsError ( try fm. removeItem ( atPath: " " ) ) {
1341
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1341
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1342
1342
XCTAssertEqual ( code, . fileReadInvalidFileName)
1343
1343
}
1344
1344
1345
1345
XCTAssertThrowsError ( try fm. copyItem ( atPath: " " , toPath: " /tmp/t " ) ) {
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
XCTAssertThrowsError ( try fm. copyItem ( atPath: " " , toPath: " " ) ) {
1350
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1350
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1351
1351
XCTAssertEqual ( code, . fileReadInvalidFileName)
1352
1352
}
1353
1353
XCTAssertThrowsError ( try fm. copyItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1354
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1354
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1355
1355
XCTAssertEqual ( code, . fileReadNoSuchFile)
1356
1356
}
1357
1357
1358
1358
XCTAssertThrowsError ( try fm. moveItem ( atPath: " " , toPath: " /tmp/t " ) ) {
1359
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1359
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1360
1360
XCTAssertEqual ( code, . fileReadInvalidFileName)
1361
1361
}
1362
1362
XCTAssertThrowsError ( try fm. moveItem ( atPath: " " , toPath: " " ) ) {
1363
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1363
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1364
1364
XCTAssertEqual ( code, . fileReadInvalidFileName)
1365
1365
}
1366
1366
XCTAssertThrowsError ( try fm. moveItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1367
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1367
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1368
1368
XCTAssertEqual ( code, . fileReadInvalidFileName)
1369
1369
}
1370
1370
1371
1371
XCTAssertThrowsError ( try fm. linkItem ( atPath: " " , toPath: " /tmp/t " ) ) {
1372
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1372
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1373
1373
XCTAssertEqual ( code, . fileReadInvalidFileName)
1374
1374
}
1375
1375
XCTAssertThrowsError ( try fm. linkItem ( atPath: " " , toPath: " " ) ) {
1376
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1376
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1377
1377
XCTAssertEqual ( code, . fileReadInvalidFileName)
1378
1378
}
1379
1379
XCTAssertThrowsError ( try fm. linkItem ( atPath: " /tmp/t " , toPath: " " ) ) {
1380
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1380
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1381
1381
XCTAssertEqual ( code, . fileReadNoSuchFile)
1382
1382
}
1383
1383
1384
1384
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " " , withDestinationPath: " " ) ) {
1385
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1385
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1386
1386
XCTAssertEqual ( code, . fileReadInvalidFileName)
1387
1387
}
1388
1388
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " " , withDestinationPath: " /tmp/t " ) ) {
1389
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1389
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1390
1390
XCTAssertEqual ( code, . fileReadInvalidFileName)
1391
1391
}
1392
1392
XCTAssertThrowsError ( try fm. createSymbolicLink ( atPath: " /tmp/t " , withDestinationPath: " " ) ) {
1393
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1393
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1394
1394
XCTAssertEqual ( code, . fileReadInvalidFileName)
1395
1395
}
1396
1396
1397
1397
XCTAssertThrowsError ( try fm. destinationOfSymbolicLink ( atPath: " " ) ) {
1398
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1398
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1399
1399
XCTAssertEqual ( code, . fileReadInvalidFileName)
1400
1400
}
1401
1401
XCTAssertFalse ( fm. fileExists ( atPath: " " ) )
@@ -1406,15 +1406,15 @@ VIDEOS=StopgapVideos
1406
1406
XCTAssertTrue ( fm. isDeletableFile ( atPath: " " ) )
1407
1407
1408
1408
XCTAssertThrowsError ( try fm. attributesOfItem ( atPath: " " ) ) {
1409
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1409
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1410
1410
XCTAssertEqual ( code, . fileReadInvalidFileName)
1411
1411
}
1412
1412
XCTAssertThrowsError ( try fm. attributesOfFileSystem ( forPath: " " ) ) {
1413
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1413
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1414
1414
XCTAssertEqual ( code, . fileReadInvalidFileName)
1415
1415
}
1416
1416
XCTAssertThrowsError ( try fm. setAttributes ( [ : ] , ofItemAtPath: " " ) ) {
1417
- let code = CocoaError . Code ( rawValue: ( $0 as? NSError ) ! . code)
1417
+ let code = CocoaError . Code ( rawValue: $0 . asNSError ( ) . code)
1418
1418
XCTAssertEqual ( code, . fileReadInvalidFileName)
1419
1419
}
1420
1420
0 commit comments