@@ -281,27 +281,8 @@ class TestProcess : XCTestCase {
281
281
}
282
282
}
283
283
284
- private func realpathOf( path: String ) -> String ? {
285
- let fm = FileManager . default
286
- let length = Int ( PATH_MAX) + 1
287
- var buf = [ Int8] ( repeating: 0 , count: length)
288
- let fsRep = fm. fileSystemRepresentation ( withPath: path)
289
- #if !DARWIN_COMPATIBILITY_TESTS
290
- defer { fsRep. deallocate ( ) }
291
- #endif
292
- guard let result = realpath ( fsRep, & buf) else {
293
- return nil
294
- }
295
- return fm. string ( withFileSystemRepresentation: result, length: strlen ( result) )
296
- }
297
-
298
284
func test_current_working_directory( ) {
299
- let tmpDir = " /tmp "
300
-
301
- guard let resolvedTmpDir = realpathOf ( path: tmpDir) else {
302
- XCTFail ( " Cant find realpath of /tmp " )
303
- return
304
- }
285
+ let tmpDir = " /tmp " . standardizingPath
305
286
306
287
let fm = FileManager . default
307
288
let previousWorkingDirectory = fm. currentDirectoryPath
@@ -310,7 +291,7 @@ class TestProcess : XCTestCase {
310
291
do {
311
292
let ( pwd, _) = try runTask ( [ xdgTestHelperURL ( ) . path, " --getcwd " ] , currentDirectoryPath: tmpDir)
312
293
// Check the sub-process used the correct directory
313
- XCTAssertEqual ( pwd. trimmingCharacters ( in: . newlines) , resolvedTmpDir )
294
+ XCTAssertEqual ( pwd. trimmingCharacters ( in: . newlines) , tmpDir )
314
295
} catch {
315
296
XCTFail ( " Test failed: \( error) " )
316
297
}
0 commit comments