Commit ace1a9a099
Verified · cmc
Layout: unified · split
Tests/OrgEditorAppKitTests/WorkspaceGateTests.swift +6 −6
| @@ -51,12 +51,12 @@ extension GateTests { | ||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /// One pass of the backlinks pane: the file's backlinks and the heading's. |
| 54 | static func backlinks(_ model: WorkspaceModel) -> (found: Int, time: Duration) { | |
| 54 | static func backlinks(_ model: WorkspaceModel) throws -> (found: Int, time: Duration) { | |
| 55 | 55 | let path = model.files.first { $0.name == "note-0.org" }!.path |
| 56 | 56 | var found = 0 |
| 57 | let time = ContinuousClock().measure { | |
| 58 | found += model.backlinks(to: Backlinks.Target(path: path)).count | |
| 59 | found += model.backlinks(to: Backlinks.Target(path: path, title: "Heading 0.1", id: "0-1")).count | |
| 57 | let time = try ContinuousClock().measure { | |
| 58 | found += try model.backlinks(to: Backlinks.Target(path: path)).count | |
| 59 | found += try model.backlinks(to: Backlinks.Target(path: path, title: "Heading 0.1", id: "0-1")).count | |
| 60 | 60 | } |
| 61 | 61 | return (found, time) |
| 62 | 62 | } |
| @@ -78,7 +78,7 @@ extension GateTests { | ||
| 78 | 78 | let items = agenda.days.reduce(0) { $0 + $1.items.count } |
| 79 | 79 | #expect(items > 0) |
| 80 | 80 | |
| 81 | let (found, backlinks) = Self.backlinks(model) | |
| 81 | let (found, backlinks) = try Self.backlinks(model) | |
| 82 | 82 | #expect(found > 0) |
| 83 | 83 | print("GATE 10,000 notes: index build \(build), agenda refresh cold \(cold) / warm \(warm) (\(items) items), backlinks over 49,400 links \(backlinks)") |
| 84 | 84 | #expect(build < .seconds(15), "index build") |
| @@ -92,7 +92,7 @@ extension GateTests { | ||
| 92 | 92 | let scratch = try Self.scratch() |
| 93 | 93 | defer { try? FileManager.default.removeItem(at: scratch) } |
| 94 | 94 | let (model, _) = try await Self.workspace(1_000, fiveLinks: 1_000, in: scratch) |
| 95 | let (found, time) = Self.backlinks(model) | |
| 95 | let (found, time) = try Self.backlinks(model) | |
| 96 | 96 | #expect(found > 0) |
| 97 | 97 | print("GATE 1,000 notes: backlinks over 5,000 links \(time)") |
| 98 | 98 | #expect(time < .milliseconds(150), "backlinks, 5,000 links") |