Skip to content

Commit 91d4c8b

Browse files
committed
Simplify the test
1 parent 2762bab commit 91d4c8b

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

Tests/ContainerAPIClientTests/ParserTest.swift

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,6 @@ struct ParserTest {
329329

330330
@Test
331331
func testRelativePaths() throws {
332-
func realpath(_ path: String) -> String {
333-
let resolved = UnsafeMutablePointer<CChar>.allocate(capacity: Int(PATH_MAX))
334-
defer { resolved.deallocate() }
335-
guard let result = Darwin.realpath(path, resolved) else {
336-
return path
337-
}
338-
return String(cString: result)
339-
}
340-
341332
// Test bind mount with relative path "."
342333
do {
343334
let tempDir = FileManager.default.temporaryDirectory.appendingPathComponent("test-bind-\(UUID().uuidString)")
@@ -350,7 +341,7 @@ struct ParserTest {
350341

351342
switch result {
352343
case .filesystem(let fs):
353-
#expect(fs.source == realpath(tempDir.path))
344+
#expect(fs.source == tempDir.standardizedFileURL.path)
354345
#expect(fs.destination == "/foo")
355346
#expect(!fs.isVolume)
356347
case .volume:
@@ -370,7 +361,7 @@ struct ParserTest {
370361

371362
switch result {
372363
case .filesystem(let fs):
373-
let expectedPath = realpath(tempDir.path)
364+
let expectedPath = tempDir.standardizedFileURL.path
374365
// Normalize trailing slashes for comparison
375366
#expect(fs.source.trimmingCharacters(in: CharacterSet(charactersIn: "/")) == expectedPath.trimmingCharacters(in: CharacterSet(charactersIn: "/")))
376367
#expect(fs.destination == "/foo")
@@ -392,7 +383,7 @@ struct ParserTest {
392383

393384
switch result {
394385
case .filesystem(let fs):
395-
let expectedPath = realpath(nestedDir.path)
386+
let expectedPath = nestedDir.standardizedFileURL.path
396387
// Normalize trailing slashes for comparison
397388
#expect(fs.source.trimmingCharacters(in: CharacterSet(charactersIn: "/")) == expectedPath.trimmingCharacters(in: CharacterSet(charactersIn: "/")))
398389
#expect(fs.destination == "/foo")

0 commit comments

Comments
 (0)