Skip to content

Commit 9c06b5e

Browse files
committed
Improve cleanup in FileManager tests
1 parent 46b20d4 commit 9c06b5e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Tests/Foundation/Tests/TestFileManager.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ class TestFileManager : XCTestCase {
223223
} catch let e {
224224
XCTFail("\(e)")
225225
}
226+
try? fm.removeItem(atPath: path)
226227
}
227228

228229
func test_isWritableFile() {
@@ -243,6 +244,7 @@ class TestFileManager : XCTestCase {
243244
} catch let e {
244245
XCTFail("\(e)")
245246
}
247+
try? fm.removeItem(atPath: path)
246248
}
247249

248250
func test_isExecutableFile() {
@@ -268,6 +270,7 @@ class TestFileManager : XCTestCase {
268270
} catch let e {
269271
XCTFail("\(e)")
270272
}
273+
try? fm.removeItem(atPath: path)
271274
}
272275

273276
func test_isDeletableFile() {
@@ -288,6 +291,8 @@ class TestFileManager : XCTestCase {
288291
// test deletable if parent directory has all necessary permissions
289292
try fm.setAttributes([.posixPermissions : NSNumber(value: Int16(0o0755))], ofItemAtPath: dir_path)
290293
XCTAssertTrue(fm.isDeletableFile(atPath: file_path))
294+
295+
try? fm.removeItem(atPath: dir_path)
291296
}
292297
catch { XCTFail("\(error)") }
293298

@@ -510,6 +515,7 @@ class TestFileManager : XCTestCase {
510515
} else {
511516
XCTFail()
512517
}
518+
try? fm.removeItem(atPath: basePath)
513519
}
514520

515521
func test_directoryEnumerator() {
@@ -854,6 +860,7 @@ class TestFileManager : XCTestCase {
854860
} catch {
855861
// ignore
856862
}
863+
cleanup()
857864
}
858865

859866
func test_linkItemAtPathToPath() {

0 commit comments

Comments
 (0)