Commit 4a2c5403dc
Verified · cmc
Layout: unified · split
Tests/OrgAppTests/FolderGrantsTests.swift +15
| @@ -56,6 +56,21 @@ struct FolderGrantsTests { | |||
| 56 | #expect(resolved.url.resolvingSymlinksInPath().path == file.resolvingSymlinksInPath().path) | 56 | #expect(resolved.url.resolvingSymlinksInPath().path == file.resolvingSymlinksInPath().path) |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | @Test func staleBookmarkIsRenewed() throws { | ||
| 60 | let folder = try Folder() | ||
| 61 | let before = folder.url.appendingPathComponent("before") | ||
| 62 | let after = folder.url.appendingPathComponent("after") | ||
| 63 | try FileManager.default.createDirectory(at: before, withIntermediateDirectories: true) | ||
| 64 | let data = try #require(SecurityBookmark.make(before, sandboxed: false)) | ||
| 65 | try FileManager.default.moveItem(at: before, to: after) | ||
| 66 | let resolved = try #require(SecurityBookmark.resolve(data, sandboxed: false)) | ||
| 67 | #expect(resolved.url.resolvingSymlinksInPath().path == after.resolvingSymlinksInPath().path) | ||
| 68 | let renewed = try #require(resolved.renewed) | ||
| 69 | let again = try #require(SecurityBookmark.resolve(renewed, sandboxed: false)) | ||
| 70 | #expect(again.url.resolvingSymlinksInPath().path == after.resolvingSymlinksInPath().path) | ||
| 71 | #expect(again.renewed == nil) | ||
| 72 | } | ||
| 73 | |||
| 59 | @Test func foldersToGrantSkipReachablePaths() { | 74 | @Test func foldersToGrantSkipReachablePaths() { |
| 60 | let reachable = [URL(fileURLWithPath: "/notes"), URL(fileURLWithPath: "/container")] | 75 | let reachable = [URL(fileURLWithPath: "/notes"), URL(fileURLWithPath: "/container")] |
| 61 | let existing: Set<String> = ["/", "/notes", "/container", "/other", "/other/site"] | 76 | let existing: Set<String> = ["/", "/notes", "/container", "/other", "/other/site"] |