File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ class TestURL : XCTestCase {
225
225
226
226
}
227
227
228
- static let gBaseTemporaryDirectoryPath = NSTemporaryDirectory ( )
228
+ static let gBaseTemporaryDirectoryPath = ( NSTemporaryDirectory ( ) as NSString ) . appendingPathComponent ( " org.swift.foundation.TestFoundation.TestURL. \( ProcessInfo . processInfo . processIdentifier ) " )
229
229
static var gBaseCurrentWorkingDirectoryPath : String {
230
230
return FileManager . default. currentDirectoryPath
231
231
}
@@ -239,6 +239,19 @@ class TestURL : XCTestCase {
239
239
static let gDirectoryExistsPath = gBaseTemporaryDirectoryPath + gDirectoryExistsName
240
240
static let gDirectoryDoesNotExistPath = gBaseTemporaryDirectoryPath + gDirectoryDoesNotExistName
241
241
242
+ override class func tearDown( ) {
243
+ let path = TestURL . gBaseTemporaryDirectoryPath
244
+ if ( try ? FileManager . default. attributesOfItem ( atPath: path) ) != nil {
245
+ do {
246
+ try FileManager . default. removeItem ( atPath: path)
247
+ } catch {
248
+ NSLog ( " Could not remove test directory at path \( path) : \( error) " )
249
+ }
250
+ }
251
+
252
+ super. tearDown ( )
253
+ }
254
+
242
255
static func setup_test_paths( ) -> Bool {
243
256
_ = FileManager . default. createFile ( atPath: gFileExistsPath, contents: nil )
244
257
@@ -255,7 +268,7 @@ class TestURL : XCTestCase {
255
268
try FileManager . default. createDirectory ( atPath: gDirectoryExistsPath, withIntermediateDirectories: false )
256
269
} catch {
257
270
// The error code is a CocoaError
258
- if ( error as? NSError ) ? . code != CocoaError . fileNoSuchFile . rawValue {
271
+ if ( error as? NSError ) ? . code != CocoaError . fileWriteFileExists . rawValue {
259
272
return false
260
273
}
261
274
}
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ var allTestCases = [
80
80
testCase ( TestNSTextCheckingResult . allTests) ,
81
81
testCase ( TestTimer . allTests) ,
82
82
testCase ( TestTimeZone . allTests) ,
83
- /* ⚠️ */ // testCase(TestURL.allTests),
83
+ testCase ( TestURL . allTests) ,
84
84
testCase ( TestURLComponents . allTests) ,
85
85
testCase ( TestURLCredential . allTests) ,
86
86
testCase ( TestURLProtectionSpace . allTests) ,
@@ -114,8 +114,4 @@ var allTestCases = [
114
114
testCase ( TestNSLock . allTests) ,
115
115
]
116
116
117
- appendTestCaseExpectedToFail ( " TestURL is not deleting its temporary directory correctly. https://bugs.swift.org/browse/SR-10538 " ,
118
- TestURL . allTests,
119
- into: & allTestCases)
120
-
121
117
XCTMain ( allTestCases)
You can’t perform that action at this time.
0 commit comments