Skip to content

Commit 7cd1e76

Browse files
committed
Fix flaky TestFileManager.test_emptyFilename
1 parent af2bcc5 commit 7cd1e76

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Tests/Foundation/TestFileManager.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,22 +1298,22 @@ class TestFileManager : XCTestCase {
12981298
XCTAssertEqual(code, emptyFileNameError ?? .fileNoSuchFile)
12991299
}
13001300

1301-
XCTAssertThrowsError(try fm.copyItem(atPath: "", toPath: "/tmp/t")) {
1301+
XCTAssertThrowsError(try fm.copyItem(atPath: "", toPath: "/test_emptyFilename_nonExistent")) {
13021302
let code = ($0 as? CocoaError)?.code
13031303
XCTAssertEqual(code, emptyFileNameError ?? .fileReadNoSuchFile)
13041304
}
13051305
XCTAssertThrowsError(try fm.copyItem(atPath: "", toPath: "")) {
13061306
let code = ($0 as? CocoaError)?.code
13071307
XCTAssertEqual(code, emptyFileNameError ?? .fileReadNoSuchFile)
13081308
}
1309-
XCTAssertThrowsError(try fm.copyItem(atPath: "/tmp/t", toPath: "")) {
1309+
XCTAssertThrowsError(try fm.copyItem(atPath: "/test_emptyFilename_nonExistent", toPath: "")) {
13101310
let code = ($0 as? CocoaError)?.code
13111311
XCTAssertEqual(code, .fileReadNoSuchFile)
13121312
}
13131313

13141314
#if false
13151315
// TODO: re-enable when URLResourceValues are supported in swift-foundation
1316-
XCTAssertThrowsError(try fm.moveItem(atPath: "", toPath: "/tmp/t")) {
1316+
XCTAssertThrowsError(try fm.moveItem(atPath: "", toPath: "/test_emptyFilename_nonExistent")) {
13171317
let code = ($0 as? CocoaError)?.code
13181318
XCTAssertEqual(code, emptyFileNameError ?? .fileReadInvalidFileName)
13191319
}
@@ -1326,7 +1326,7 @@ class TestFileManager : XCTestCase {
13261326
XCTAssertEqual(code, .fileWriteFileExists)
13271327
#endif
13281328
}
1329-
XCTAssertThrowsError(try fm.moveItem(atPath: "/tmp/t", toPath: "")) {
1329+
XCTAssertThrowsError(try fm.moveItem(atPath: "/test_emptyFilename_nonExistent", toPath: "")) {
13301330
let code = ($0 as? CocoaError)?.code
13311331
#if os(Windows)
13321332
XCTAssertEqual(code, .fileNoSuchFile)
@@ -1335,15 +1335,15 @@ class TestFileManager : XCTestCase {
13351335
#endif
13361336
}
13371337

1338-
XCTAssertThrowsError(try fm.linkItem(atPath: "", toPath: "/tmp/t")) {
1338+
XCTAssertThrowsError(try fm.linkItem(atPath: "", toPath: "/test_emptyFilename_nonExistent")) {
13391339
let code = ($0 as? CocoaError)?.code
13401340
XCTAssertEqual(code, emptyFileNameError ?? .fileReadNoSuchFile)
13411341
}
13421342
XCTAssertThrowsError(try fm.linkItem(atPath: "", toPath: "")) {
13431343
let code = ($0 as? CocoaError)?.code
13441344
XCTAssertEqual(code, emptyFileNameError ?? .fileReadNoSuchFile)
13451345
}
1346-
XCTAssertThrowsError(try fm.linkItem(atPath: "/tmp/t", toPath: "")) {
1346+
XCTAssertThrowsError(try fm.linkItem(atPath: "/test_emptyFilename_nonExistent", toPath: "")) {
13471347
let code = ($0 as? CocoaError)?.code
13481348
XCTAssertEqual(code, .fileReadNoSuchFile)
13491349
}
@@ -1352,11 +1352,11 @@ class TestFileManager : XCTestCase {
13521352
let code = ($0 as? CocoaError)?.code
13531353
XCTAssertEqual(code, emptyFileNameError ?? .fileNoSuchFile)
13541354
}
1355-
XCTAssertThrowsError(try fm.createSymbolicLink(atPath: "", withDestinationPath: "/tmp/t")) {
1355+
XCTAssertThrowsError(try fm.createSymbolicLink(atPath: "", withDestinationPath: "/test_emptyFilename_nonExistent")) {
13561356
let code = ($0 as? CocoaError)?.code
13571357
XCTAssertEqual(code, emptyFileNameError ?? .fileNoSuchFile)
13581358
}
1359-
XCTAssertThrowsError(try fm.createSymbolicLink(atPath: "/tmp/t", withDestinationPath: "")) {
1359+
XCTAssertThrowsError(try fm.createSymbolicLink(atPath: "/test_emptyFilename_nonExistent", withDestinationPath: "")) {
13601360
let code = ($0 as? CocoaError)?.code
13611361
XCTAssertEqual(code, .fileNoSuchFile)
13621362
}
@@ -1387,8 +1387,8 @@ class TestFileManager : XCTestCase {
13871387

13881388
XCTAssertNil(fm.contents(atPath: ""))
13891389
XCTAssertFalse(fm.contentsEqual(atPath: "", andPath: ""))
1390-
XCTAssertFalse(fm.contentsEqual(atPath: "/tmp/t", andPath: ""))
1391-
XCTAssertFalse(fm.contentsEqual(atPath: "", andPath: "/tmp/t"))
1390+
XCTAssertFalse(fm.contentsEqual(atPath: "/test_emptyFilename_nonExistent", andPath: ""))
1391+
XCTAssertFalse(fm.contentsEqual(atPath: "", andPath: "/test_emptyFilename_nonExistent"))
13921392

13931393
//_ = fm.fileSystemRepresentation(withPath: "") // NSException
13941394
XCTAssertEqual(fm.string(withFileSystemRepresentation: UnsafePointer(bitPattern: 1)!, length: 0), "")

0 commit comments

Comments
 (0)