Tests/OrgCoreTests/LintTests.swift
396 lines · 20309 bytes
1import Foundation
2import Testing
3@testable import OrgCore
4
5struct LintTests {
6 /// Files with problems of most kinds, which `LintOracleTests` also runs through org-lint.
7 static let corpus: [String: String] = [
8 "links.org": """
9 #+TITLE: Links
10 * Heading one
11 :PROPERTIES:
12 :CUSTOM_ID: one
13 :ID: abc::def
14 :END:
15 SCHEDULED: <2026-11-26 Thu>
16 Link [[*Missing heading]] and [[*Heading one]] and [[#nope]] and [[#one]].
17 [[id:00000000-dead]] and [[file:nofile.org]] and [[./exists.org]] and [[id:abc::def]].
18 <2026-11-26 Mon> <2026-11-26> <2026-11-26 Thu 9:00> <2026-02-30 Mon> <2026-11-26 Thu 25:00> [2026-11-26 Thu 10:00-11:00]
19 <2026-11-26 Thu 9am> <2026-11-26 Thu 10:00>--<2026-11-27 Fri> <2026-11-26 Thu +1w -2d> <2026-11-26 Thu .+2d/3d>
20 Footnote[fn:1] and [fn:missing] and [fn:: anon] and [fn:named: inline] and [fn:named].
21 * Second
22 :PROPERTIES:
23 :CUSTOM_ID: one
24 :END:
25 #+NAME: tbl
26 | a |
27
28 #+NAME: tbl
29 | b <2026-11-26> |
30 <<target>> <<target>> <<My Target>>
31 [[my target]] [[tbl]] [[TBL]] [[second]] [[*second]] [[Heading one]] [[nowhere]]
32 [[(here)]] [[(nothere)]] [[file+sys:./exists.org]] [[attachment:nothing.png]]
33 #+BEGIN_SRC emacs-lisp
34 (foo) (ref:here)
35 #+END_SRC
36 * COMMENT Commented [1/2]
37 [[Commented]] [[*commented]]
38 * TODO [#A] Task title :tag:
39 [[Task title]] [[*TODO Task title]]
40 [fn:1] Def.
41 [fn:2] Unused.
42 [fn:1] Dup.
43 """,
44 "structure.org": """
45 #+CATEGORY: one
46 #+CATEGORY: two
47 #+SETUPFILE: missing-setup.org
48 #+TITLE no colon
49 #+CAPTION: orphan
50
51 * QUOTE old section
52 * Tags :a::b:
53 * Planning
54 SCHEDULED: <2026-11-26 Thu +1w> DEADLINE: <2026-11-27 Fri +2d>
55 * Inactive
56 SCHEDULED: [2026-11-26 Thu]
57 * Repeaters same
58 SCHEDULED: <2026-11-26 Thu +1w> DEADLINE: <2026-11-27 Fri +1w>
59 * Body
60 Text here
61 :PROPERTIES:
62 :A: b
63 :END:
64 %%(diary-date 1 1 2026) indented
65 #+BEGIN_EXPORT
66 x
67 #+END_EXPORT
68 #+BEGIN_HTML
69 <b>x</b>
70 #+END_HTML
71 :OUTER:
72 :INNER:
73 x
74 :END:
75 #+BEGIN_EXAMPLE
76 x
77 #+END_EXAMPLE trailing
78 Paragraph ** Oops heading
79 #+SRCNAME: old
80 #+BEGIN_SRC sh
81 echo
82 #+END_SRC
83 #+BEGIN_SRC
84 #+END_SRC
85 :PROPERTIES:
86 :EFFORT: abc
87 :END:
88 * Effort
89 :PROPERTIES:
90 :EFFORT: abc
91 :Effort: def
92 :TODO: x
93 :ID:
94 :END:
95 CLOCK: [2026-11-26 Thu 9:00]--[2026-11-26 Thu 10:00] => 1:00
96 CLOCK: [2026-11-26 Thu 09:00]--[2026-11-26 Thu 10:00] => 1:00
97 CLOCK: [2026-11-26 Thu 09:00]--[2026-11-26 Thu 10:00] => 1:00
98 :LOGBOOK:
99 text
100 * [#Z] Priority
101 * [#a] Lower
102 * [#1 Unclosed
103 * TODOX Unknown keyword
104 ** Heading after
105 :drawer:
106 #+BEGIN_SRC sh
107 :inner:
108 #+END_SRC
109 :END:
110 #+BEGIN_QUOTE
111 never closed
112 :END:
113 DEADLINE: <2026-11-26 Thu>
114 """,
115 ]
116
117 static func lint(_ text: String, path: String? = nil, environment: LintEnvironment = .fileSystem, defaults: OrgSettings = .default) -> [LintFinding] {
118 OrgLint.lint(text, tree: OrgParser.parse(text, defaults: defaults), path: path, environment: environment)
119 }
120
121 /// The lines `checker` reports in `text`.
122 static func lines(_ checker: LintChecker, _ text: String, path: String? = nil, environment: LintEnvironment = .fileSystem) -> [Int] {
123 lint(text, path: path, environment: environment).filter { $0.checker == checker }.map(\.line)
124 }
125
126 /// A file system holding only `files` (absolute paths; folders end in `/`).
127 static func environment(_ files: Set<String>, ids: [String: [String]]? = nil) -> LintEnvironment {
128 var idFiles: (@Sendable (String) -> [String])?
129 if let ids { idFiles = { ids[$0] ?? [] } }
130 return LintEnvironment(
131 fileExists: { path in files.contains(path) || files.contains(path + "/") },
132 isDirectory: { files.contains($0 + "/") },
133 contentsOfDirectory: { dir in
134 Array(Set(files.compactMap { file -> String? in
135 guard file.hasPrefix(dir + "/") else { return nil }
136 return file.dropFirst(dir.count + 1).split(separator: "/").first.map(String.init)
137 }))
138 },
139 readFile: { _ in nil },
140 idFiles: idFiles
141 )
142 }
143
144 // MARK: - Links
145
146 @Test func fuzzyLinks() {
147 let text = "* Heading one\n<<Target here>>\n#+NAME: tbl\n| a |\n\n[[*Heading one]] [[heading ONE]] [[target here]] [[tbl]]\n[[*Nope]] [[TBL]] [[*Target here]]\n"
148 #expect(Self.lines(.invalidFuzzyLink, text) == [7, 7, 7])
149 }
150
151 @Test func customIDLinks() {
152 let text = "* A\n:PROPERTIES:\n:CUSTOM_ID: a\n:ID: uuid-1\n:END:\n[[#a]] [[#uuid-1]]\n[[#b]]\n"
153 #expect(Self.lines(.invalidCustomIDLink, text) == [7])
154 }
155
156 @Test func idLinksResolveThroughTheIndex() {
157 let text = ":PROPERTIES:\n:ID: file-id\n:END:\n* A\n:PROPERTIES:\n:ID: here\n:END:\n[[id:here]] [[id:file-id]] [[id:there]]\n[[id:nowhere]]\n"
158 let environment = Self.environment([], ids: ["there": ["/notes/other.org"]])
159 #expect(Self.lines(.invalidIDLink, text, environment: environment) == [9])
160 #expect(Self.lines(.invalidIDLink, text, environment: Self.environment([])) == [8, 9])
161 }
162
163 @Test func coderefLinks() {
164 let text = "#+BEGIN_SRC sh\necho (ref:one)\n#+END_SRC\n[[(one)]]\n[[(two)]]\n"
165 #expect(Self.lines(.invalidCoderefLink, text) == [5])
166 }
167
168 @Test func fileLinks() {
169 let environment = Self.environment(["/notes/a.org", "/notes/sub/"])
170 let text = "[[file:a.org]] [[./sub]] [[file:/ssh:host:/x]]\n[[file:missing.org]] [[~/nowhere-at-all]]\n"
171 #expect(Self.lines(.linkToLocalFile, text, path: "/notes/x.org", environment: environment) == [2, 2])
172 #expect(Self.lines(.linkToLocalFile, text, path: nil, environment: environment).isEmpty)
173 }
174
175 @Test func fileSearchLinks() {
176 var environment = Self.environment(["/notes/a.org"])
177 environment.readFile = { _ in "* Alpha\n:PROPERTIES:\n:CUSTOM_ID: al\n:END:\n<<tgt>>\n" }
178 let text = "[[file:a.org::*Alpha]] [[file:a.org::#al]] [[file:a.org::tgt]] [[file:a.org::12]]\n[[file:a.org::*Beta]] [[file:a.org::#be]]\n"
179 #expect(Self.lines(.invalidFileSearch, text, path: "/notes/x.org", environment: environment) == [2, 2])
180 }
181
182 @Test func fileApplicationLinks() {
183 #expect(Self.lines(.fileApplication, "[[file:a.org]]\n[[file+sys:a.org]] [[file+emacs:b.org]]\n") == [2, 2])
184 }
185
186 @Test func attachmentLinks() {
187 let environment = Self.environment(["/notes/data/ab/cdef/", "/notes/data/ab/cdef/one.png"])
188 let text = "* A :ATTACH:\n:PROPERTIES:\n:ID: abcdef\n:END:\n[[attachment:one.png]]\n[[attachment:two.png]]\n"
189 let findings = Self.lint(text, path: "/notes/x.org", environment: environment).filter { $0.checker == .linkToLocalFile }
190 #expect(findings.map(\.line) == [6])
191 #expect(findings.first?.message == "Link to non-existent local file \"/notes/data/ab/cdef/two.png\"")
192 }
193
194 // MARK: - Attachments
195
196 @Test func attachTagWithoutFolder() {
197 let environment = Self.environment(["/notes/data/ab/cdef/"])
198 let text = "* A :ATTACH:\n:PROPERTIES:\n:ID: abcdef\n:END:\n* B :ATTACH:\n:PROPERTIES:\n:ID: abcxyz\n:END:\n* C :ATTACH:\n"
199 #expect(Self.lines(.missingAttachmentFolder, text, path: "/notes/x.org", environment: environment) == [5, 9])
200 }
201
202 @Test func attachmentFoldersWithoutEntries() {
203 let files: Set<String> = ["/notes/data/", "/notes/data/ab/", "/notes/data/ab/cdef/", "/notes/data/ab/zzzz/", "/notes/data/ab/yyyy/",
204 "/notes/data/__/", "/notes/data/__/q/", "/notes/data/__/q/qq/"]
205 let environment = Self.environment(files, ids: ["abyyyy": ["/notes/other.org"], "abzzzz": ["/notes/x.org"]])
206 let text = "* A\n:PROPERTIES:\n:ID: abcdef\n:END:\n"
207 let findings = Self.lint(text, path: "/notes/x.org", environment: environment).filter { $0.checker == .orphanedAttachmentFolder }
208 #expect(findings.map(\.message) == ["Attachment folder \"data/__/q/qq\" belongs to no entry", "Attachment folder \"data/ab/zzzz\" belongs to no entry"])
209 #expect(findings.allSatisfy { $0.line == 1 })
210 // Without an index there is nothing to tell an orphan from another file's folder.
211 #expect(Self.lines(.orphanedAttachmentFolder, text, path: "/notes/x.org", environment: Self.environment(files)).isEmpty)
212 }
213
214 // MARK: - Duplicates
215
216 @Test func duplicateIDs() {
217 let text = "* A\n:PROPERTIES:\n:ID: one\n:END:\n* B\n:PROPERTIES:\n:ID: one\n:END:\n* C\n:PROPERTIES:\n:ID: two\n:END:\n* D\n:PROPERTIES:\n:ID: three\n:END:\n"
218 let findings = Self.lint(text, path: "/notes/x.org", environment: Self.environment([], ids: ["two": ["/notes/y.org", "/notes/x.org"]]))
219 .filter { $0.checker == .duplicateID }
220 #expect(findings.map(\.line) == [3, 7, 11])
221 #expect(findings.last?.message == "Duplicate ID \"two\", also in y.org")
222 }
223
224 @Test func duplicateCustomIDsNamesTargetsAndFootnotes() {
225 let text = "* A\n:PROPERTIES:\n:CUSTOM_ID: x\n:END:\n* B\n:PROPERTIES:\n:custom_id: x\n:END:\n#+NAME: n\n| 1 |\n\n#+NAME: n\n| 2 |\n\n<<t>> <<u>>\n<<t>>\n[fn:1] a\n[fn:1] b\n[fn:2] c\n"
226 let findings = Self.lint(text)
227 #expect(findings.filter { $0.checker == .duplicateCustomID }.map(\.line) == [3, 7])
228 #expect(findings.filter { $0.checker == .duplicateName }.map(\.line) == [9, 12])
229 #expect(findings.filter { $0.checker == .duplicateTarget }.map(\.line) == [15, 16])
230 #expect(findings.filter { $0.checker == .duplicateFootnoteDefinition }.map(\.line) == [17, 18])
231 }
232
233 // MARK: - Drawers and blocks
234
235 @Test func drawers() {
236 let text = "* A\n:LOGBOOK:\n- a\n:END:\n:NOTES:\nopen\n* B\n:OUTER:\n:INNER:\n:END:\n#+BEGIN_SRC sh\n:SRC:\n#+END_SRC\n"
237 let findings = Self.lint(text).filter { $0.checker == .incompleteDrawer }
238 #expect(findings.map(\.line) == [5, 9])
239 #expect(findings.map(\.message) == ["Possible incomplete drawer \":NOTES:\"", "Possible misleading drawer entry \":INNER:\""])
240 }
241
242 @Test func propertyDrawers() {
243 let text = "* A\n:PROPERTIES:\n:A: 1\n:END:\nText\n:PROPERTIES:\n:B: 2\n:END:\n* B\n:PROPERTIES:\n:C: 3\n\n:END:\n"
244 #expect(Self.lines(.obsoletePropertiesDrawer, text) == [6, 10])
245 }
246
247 @Test func blocks() {
248 let text = "#+BEGIN_SRC sh\nx\n#+END_SRC\n#+BEGIN_QUOTE\nopen\n#+END_SRC trailing\n#+BEGIN: clocktable\n#+END:\n"
249 let findings = Self.lint(text).filter { $0.checker == .invalidBlock }
250 #expect(findings.map(\.line) == [4, 6])
251 #expect(findings.map(\.message) == ["Possible incomplete block \"#+BEGIN_QUOTE\"", "Invalid block closing line \"#+END_SRC trailing\""])
252 }
253
254 @Test func blockLanguagesAndBackends() {
255 let text = "#+BEGIN_SRC python\n#+END_SRC\n#+BEGIN_SRC :results none\n#+END_SRC\n#+BEGIN_EXPORT html\n#+END_EXPORT\n#+BEGIN_EXPORT\n#+END_EXPORT\n#+BEGIN_LATEX\n#+END_LATEX\n#+BEGIN_NOTE\n#+END_NOTE\n"
256 let findings = Self.lint(text)
257 #expect(findings.filter { $0.checker == .missingLanguageInSrcBlock }.map(\.line) == [3])
258 #expect(findings.filter { $0.checker == .missingBackendInExportBlock }.map(\.line) == [7])
259 #expect(findings.filter { $0.checker == .deprecatedExportBlocks }.map(\.line) == [9])
260 }
261
262 @Test func misplacedPlanning() {
263 let text = "* A\nSCHEDULED: <2026-11-26 Thu>\n* B\nText\nDEADLINE: <2026-11-26 Thu>\n#+BEGIN_EXAMPLE\nCLOSED: [2026-11-26 Thu]\n#+END_EXAMPLE\n* C\n:PROPERTIES:\n:A: b\n:END:\nscheduled: later\n"
264 #expect(Self.lines(.misplacedPlanningInfo, text) == [5, 13])
265 }
266
267 @Test func misplacedHeadings() {
268 #expect(Self.lines(.misplacedHeading, "* A\nText** Oops\nText ** fine\n,** escaped\n#+BEGIN_SRC sh\nx** y\n#+END_SRC\n") == [2])
269 }
270
271 @Test func indentedDiarySexps() {
272 #expect(Self.lines(.indentedDiarySexp, "%%(diary-float t 4 2)\n %%(diary-float t 4 2)\n#+BEGIN_SRC sh\n %%(x)\n#+END_SRC\n") == [2])
273 }
274
275 @Test func keywordSyntax() {
276 let text = "#+TITLE: fine\n#+TITLE wrong\n#+CAPTION[short]: long\n#+BEGIN_SRC sh\n#+END_SRC\n#+\n"
277 #expect(Self.lines(.invalidKeywordSyntax, text) == [2, 6])
278 }
279
280 @Test func affiliatedKeywords() {
281 let text = "#+CAPTION: orphan\n\n#+NAME: fine\n#+TBLNAME: old\n| a |\n#+RESULTS:\n\n#+ATTR_HTML: :width 10\n* H\n"
282 let findings = Self.lint(text)
283 #expect(findings.filter { $0.checker == .orphanedAffiliatedKeywords }.map(\.line) == [1, 8])
284 #expect(findings.filter { $0.checker == .obsoleteAffiliatedKeywords }.map(\.message) == ["Obsolete affiliated keyword: \"TBLNAME\". Use \"NAME\" instead"])
285 }
286
287 @Test func categoriesAndSetupFiles() {
288 let environment = Self.environment(["/notes/setup.org"])
289 let text = "#+CATEGORY: a\n#+SETUPFILE: setup.org\n#+SETUPFILE: \"missing.org\"\n#+SETUPFILE: https://example.com/x.org\n#+CATEGORY: b\n"
290 let findings = Self.lint(text, path: "/notes/x.org", environment: environment)
291 #expect(findings.filter { $0.checker == .deprecatedCategorySetup }.map(\.line) == [5])
292 #expect(findings.filter { $0.checker == .nonExistentSetupfileParameter }.map(\.message) == ["Non-existent setup file \"missing.org\""])
293 }
294
295 // MARK: - Headings and properties
296
297 @Test func unknownTodoKeywords() {
298 var defaults = OrgSettings.default
299 defaults.todoSequences = [TodoSequence(kind: .sequence, active: [TodoKeyword(name: "TODO"), TodoKeyword(name: "WAIT")], done: [TodoKeyword(name: "DONE")])]
300 let text = "* TODO Known\n* WAIT From the config\n* NEXT Unknown\n* TODOX Typo\n* FAQ Questions\n* README\n* DONT x\n* COMMENT x\n"
301 let findings = Self.lint(text, defaults: defaults).filter { $0.checker == .unknownTodoKeyword }
302 #expect(findings.map(\.line) == [3, 4, 7])
303 // The file's own keywords count.
304 #expect(Self.lines(.unknownTodoKeyword, "#+TODO: NEXT | DONE\n* NEXT a\n* TODO b\n") == [3])
305 }
306
307 @Test func priorities() {
308 let text = "* [#A] Fine\n* [#Z] Out\n* [#a] Lower\n* [#1 Unclosed\n* TODO [#B] Fine\n* [#AA] Two\n"
309 let findings = Self.lint(text).filter { $0.checker == .priority }
310 #expect(findings.map(\.message) == ["Out-of-bounds priority 'Z'", "Malformed priority '[#1 Unclosed'", "Invalid priority 'AA'"])
311 }
312
313 @Test func headingTags() {
314 let text = "* A :x:y:\n* B :x::y:\n* QUOTE Old\n* COMMENT QUOTE Older\n* QUOTE\n"
315 let findings = Self.lint(text)
316 #expect(findings.filter { $0.checker == .spuriousColons }.map(\.line) == [2])
317 #expect(findings.filter { $0.checker == .quoteSection }.map(\.line) == [3, 4])
318 }
319
320 @Test func properties() {
321 let text = "* A\n:PROPERTIES:\n:EFFORT: 1:30\n:EFFORT: 2h 30min\n:EFFORT: soon\n:EFFORT: 15\n:Effort: soon\n:TODO: x\n:Scheduled: y\n:ID: a::b\n:ID: ab\n:END:\n"
322 let findings = Self.lint(text)
323 #expect(findings.filter { $0.checker == .invalidEffortProperty }.map(\.line) == [5, 6])
324 #expect(findings.filter { $0.checker == .specialPropertyInPropertiesDrawer }.map(\.line) == [8, 9])
325 #expect(findings.filter { $0.checker == .invalidIDProperty }.map(\.line) == [10])
326 }
327
328 // MARK: - Timestamps
329
330 @Test func timestamps() {
331 let fine = ["<2026-11-26 Thu>", "[2026-11-26 Thu 09:00]", "<2026-11-26 Thu 10:00-11:00>", "<2026-11-26 Thu>--<2026-11-27 Fri>",
332 "<2026-11-26 Thu +1w -2d>", "<2026-11-26 Thu .+2d/3d>", "<2026-11-26 Thu ++1m --3d>", "<%%(diary-float t 4 2)>"]
333 for stamp in fine {
334 #expect(Self.lines(.timestampSyntax, "Text \(stamp)\n").isEmpty, "\(stamp)")
335 }
336 let malformed: [(String, String)] = [
337 ("<2026-11-26>", "<2026-11-26 Thu>"), ("<2026-11-26 Mon>", "<2026-11-26 Thu>"), ("<2026-11-26 Thu 9:00>", "<2026-11-26 Thu 09:00>"),
338 ("<2026-02-30 Mon>", "<2026-03-02 Mon>"), ("<2026-11-26 Thu 25:00>", "<2026-11-27 Fri 01:00>"), ("<2026-11-26 Thu 9am>", "<2026-11-26 Thu>"),
339 ("<2026-11-26 Thu 10:00>--<2026-11-27 Fri>", "<2026-11-26 Thu 10:00>--<2026-11-27 Fri 10:00>"),
340 ]
341 for (stamp, parsed) in malformed {
342 let findings = Self.lint("Text \(stamp)\n").filter { $0.checker == .timestampSyntax }
343 #expect(findings.map(\.message) == ["Potentially malformed timestamp \(stamp). Parsed as: \(parsed)"])
344 }
345 // Planning lines are checked by the planning checkers only.
346 #expect(Self.lines(.timestampSyntax, "* A\nSCHEDULED: <2026-11-26>\n").isEmpty)
347 }
348
349 @Test func clocks() {
350 let text = "* A\n:LOGBOOK:\nCLOCK: [2026-11-26 Thu 09:00]--[2026-11-26 Thu 10:00] => 1:00\nCLOCK: [2026-11-26 Thu 09:00]--[2026-11-26 Thu 10:00] => 1:00\nCLOCK: [2026-11-26 Thu 9:00]\nCLOCK: [2026-11-26 Thu 09:00]\n:END:\n"
351 #expect(Self.lines(.clockSyntax, text) == [4, 5])
352 }
353
354 @Test func planning() {
355 let text = "* A\nSCHEDULED: [2026-11-26 Thu]\n* B\nDEADLINE: [2026-11-26 Thu]\n* C\nSCHEDULED: <2026-11-26 Thu +1w> DEADLINE: <2026-11-27 Fri ++2d>\n* D\nSCHEDULED: <2026-11-26 Thu +1w> DEADLINE: <2026-11-27 Fri +1w>\n* E\nSCHEDULED: <2026-11-26 Thu .+1w> DEADLINE: <2026-11-27 Fri +2d>\n"
356 let findings = Self.lint(text)
357 #expect(findings.filter { $0.checker == .planningInactive }.map(\.line) == [2, 4])
358 #expect(findings.filter { $0.checker == .mismatchedPlanningRepeaters }.map(\.line) == [6])
359 }
360
361 // MARK: - Footnotes
362
363 @Test func footnotes() {
364 let text = "Text[fn:1] [fn:2] [fn:in: inline] [fn:in] [fn:: anonymous] [fn:gone]\n\n[fn:1] One.\n[fn:3] Three.\n"
365 let findings = Self.lint(text)
366 #expect(findings.filter { $0.checker == .undefinedFootnoteReference }.map(\.message) == ["Missing definition for footnote [2]", "Missing definition for footnote [gone]"])
367 #expect(findings.filter { $0.checker == .unreferencedFootnoteDefinition }.map(\.line) == [4])
368 }
369
370 // MARK: - Whole file
371
372 @Test func encryptedEntriesAreSkipped() {
373 let text = "* Secret :crypt:\n-----BEGIN PGP MESSAGE-----\n\n#+BEGIN_QUOTE\n:DRAWER:\n-----END PGP MESSAGE-----\n* Open\n#+BEGIN_QUOTE\n"
374 #expect(Self.lint(text).map(\.line) == [8])
375 }
376
377 @Test func findingsAreInFileOrderWithLines() {
378 let text = "[[#b]]\r\n* A\r\n[[#a]]\r\n"
379 let findings = Self.lint(text)
380 #expect(findings.map(\.line) == [1, 3])
381 #expect(findings.map(\.offset) == [0, 13])
382 #expect(findings.allSatisfy { $0.trust == .high })
383 #expect(Self.lint("").isEmpty)
384 }
385
386 /// Entries with planning, properties, logbooks, links and footnotes that are all fine. The
387 /// performance gates time Lint File on 1 MB files.
388 @Test func wellFormedEntries() {
389 var text = "#+TITLE: Large\n"
390 for i in 0..<500 {
391 text += "* TODO Entry \(i) [1/2] :tag:\nSCHEDULED: <2026-11-26 Thu>\n:PROPERTIES:\n:ID: id-\(i)\n:CUSTOM_ID: c\(i)\n:END:\n:LOGBOOK:\nCLOCK: [2026-11-26 Thu 09:00]--[2026-11-26 Thu 10:00] => 1:00\n:END:\n"
392 text += "Body with [[#c\(i)]], [[id:id-\(i)]], [[*Entry \(i)]] and a note[fn:\(i)].\n- item one\n- item two <2026-11-27 Fri>\n\n[fn:\(i)] Note \(i).\n\n"
393 }
394 #expect(Self.lint(text).isEmpty)
395 }
396}