@@ -27,7 +27,7 @@ final class DoccDocumentationTests: XCTestCase {
27
27
try await renderDocumentation (
28
28
swiftFile: " 1️⃣ " ,
29
29
expectedResponses: [
30
- " 1️⃣ " : . error( . noDocumentation )
30
+ " 1️⃣ " : . error( . noDocumentableSymbols )
31
31
]
32
32
)
33
33
}
@@ -44,7 +44,7 @@ final class DoccDocumentationTests: XCTestCase {
44
44
" 1️⃣ " : . renderNode( kind: . symbol, path: " test/function() " ) ,
45
45
" 2️⃣ " : . renderNode( kind: . symbol, path: " test/function() " ) ,
46
46
" 3️⃣ " : . renderNode( kind: . symbol, path: " test/function() " ) ,
47
- " 4️⃣ " : . error ( . noDocumentation ) ,
47
+ " 4️⃣ " : . renderNode ( kind : . symbol , path : " test/function() " ) ,
48
48
]
49
49
)
50
50
}
@@ -76,7 +76,7 @@ final class DoccDocumentationTests: XCTestCase {
76
76
" 6️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/bar " ) ,
77
77
" 7️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/init(_:bar:) " ) ,
78
78
" 8️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/init(_:bar:) " ) ,
79
- " 9️⃣ " : . error ( . noDocumentation ) ,
79
+ " 9️⃣ " : . renderNode ( kind : . symbol , path : " test/Structure " ) ,
80
80
]
81
81
)
82
82
}
@@ -92,7 +92,7 @@ final class DoccDocumentationTests: XCTestCase {
92
92
" 1️⃣ " : . renderNode( kind: . symbol, path: " test/Structure " ) ,
93
93
" 2️⃣ " : . renderNode( kind: . symbol, path: " test/Structure " ) ,
94
94
" 3️⃣ " : . renderNode( kind: . symbol, path: " test/Structure " ) ,
95
- " 4️⃣ " : . error ( . noDocumentation ) ,
95
+ " 4️⃣ " : . renderNode ( kind : . symbol , path : " test/Structure " ) ,
96
96
]
97
97
)
98
98
}
@@ -125,7 +125,7 @@ final class DoccDocumentationTests: XCTestCase {
125
125
" 7️⃣ " : . renderNode( kind: . symbol, path: " test/Class/init(_:bar:) " ) ,
126
126
" 8️⃣ " : . renderNode( kind: . symbol, path: " test/Class/init(_:bar:) " ) ,
127
127
" 9️⃣ " : . renderNode( kind: . symbol, path: " test/Class " ) ,
128
- " 0️⃣ " : . error ( . noDocumentation ) ,
128
+ " 0️⃣ " : . renderNode ( kind : . symbol , path : " test/Class " ) ,
129
129
]
130
130
)
131
131
}
@@ -141,7 +141,7 @@ final class DoccDocumentationTests: XCTestCase {
141
141
" 1️⃣ " : . renderNode( kind: . symbol, path: " test/Class " ) ,
142
142
" 2️⃣ " : . renderNode( kind: . symbol, path: " test/Class " ) ,
143
143
" 3️⃣ " : . renderNode( kind: . symbol, path: " test/Class " ) ,
144
- " 4️⃣ " : . error ( . noDocumentation ) ,
144
+ " 4️⃣ " : . renderNode ( kind : . symbol , path : " test/Class " ) ,
145
145
]
146
146
)
147
147
}
@@ -173,7 +173,7 @@ final class DoccDocumentationTests: XCTestCase {
173
173
" 6️⃣ " : . renderNode( kind: . symbol, path: " test/Actor/bar " ) ,
174
174
" 7️⃣ " : . renderNode( kind: . symbol, path: " test/Actor/init(_:bar:) " ) ,
175
175
" 8️⃣ " : . renderNode( kind: . symbol, path: " test/Actor/init(_:bar:) " ) ,
176
- " 9️⃣ " : . error ( . noDocumentation ) ,
176
+ " 9️⃣ " : . renderNode ( kind : . symbol , path : " test/Actor " ) ,
177
177
]
178
178
)
179
179
}
@@ -189,7 +189,7 @@ final class DoccDocumentationTests: XCTestCase {
189
189
" 1️⃣ " : . renderNode( kind: . symbol, path: " test/Actor " ) ,
190
190
" 2️⃣ " : . renderNode( kind: . symbol, path: " test/Actor " ) ,
191
191
" 3️⃣ " : . renderNode( kind: . symbol, path: " test/Actor " ) ,
192
- " 4️⃣ " : . error ( . noDocumentation ) ,
192
+ " 4️⃣ " : . renderNode ( kind : . symbol , path : " test/Actor " ) ,
193
193
]
194
194
)
195
195
}
@@ -218,7 +218,7 @@ final class DoccDocumentationTests: XCTestCase {
218
218
" 6️⃣ " : . renderNode( kind: . symbol, path: " test/Enum/second " ) ,
219
219
" 7️⃣ " : . renderNode( kind: . symbol, path: " test/Enum/third(_:) " ) ,
220
220
" 8️⃣ " : . renderNode( kind: . symbol, path: " test/Enum/third(_:) " ) ,
221
- " 9️⃣ " : . error ( . noDocumentation ) ,
221
+ " 9️⃣ " : . renderNode ( kind : . symbol , path : " test/Enum " ) ,
222
222
]
223
223
)
224
224
}
@@ -289,7 +289,7 @@ final class DoccDocumentationTests: XCTestCase {
289
289
" 4️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol/foo " ) ,
290
290
" 5️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol/bar " ) ,
291
291
" 6️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol/bar " ) ,
292
- " 7️⃣ " : . error ( . noDocumentation ) ,
292
+ " 7️⃣ " : . renderNode ( kind : . symbol , path : " test/Protocol " ) ,
293
293
]
294
294
)
295
295
}
@@ -306,19 +306,21 @@ final class DoccDocumentationTests: XCTestCase {
306
306
" 1️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol " ) ,
307
307
" 2️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol " ) ,
308
308
" 3️⃣ " : . renderNode( kind: . symbol, path: " test/Protocol " ) ,
309
- " 4️⃣ " : . error ( . noDocumentation ) ,
309
+ " 4️⃣ " : . renderNode ( kind : . symbol , path : " test/Protocol " ) ,
310
310
]
311
311
)
312
312
}
313
313
314
314
func testExtension( ) async throws {
315
- try await renderDocumentation (
316
- swiftFile: """
315
+ let project = try await SwiftPMTestProject (
316
+ files: [
317
+ " MyLibrary/Structure.swift " : """
317
318
/// A structure containing important information
318
319
public struct Structure {
319
320
let number: Int
320
321
}
321
-
322
+ """ ,
323
+ " MyLibrary/Extension.swift " : """
322
324
extension Stru1️⃣cture {
323
325
/// One more than the number
324
326
var numberPlusOne: Int {2️⃣ number + 1 }
@@ -332,13 +334,35 @@ final class DoccDocumentationTests: XCTestCase {
332
334
}
333
335
}6️⃣
334
336
""" ,
337
+ ] ,
338
+ enableBackgroundIndexing: true
339
+ )
340
+ try await renderDocumentation (
341
+ fileName: " Extension.swift " ,
342
+ project: project,
343
+ expectedResponses: [
344
+ " 1️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/numberPlusOne " ) ,
345
+ " 2️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/numberPlusOne " ) ,
346
+ " 3️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/Kind " ) ,
347
+ " 4️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/Kind/first " ) ,
348
+ " 5️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/Kind/second " ) ,
349
+ " 6️⃣ " : . renderNode( kind: . symbol, path: " MyLibrary/Structure/numberPlusOne " ) ,
350
+ ]
351
+ )
352
+ }
353
+
354
+ func testCursorInImport( ) async throws {
355
+ try await renderDocumentation (
356
+ swiftFile: """
357
+ import Found1️⃣ation
358
+
359
+ /// A structure containing important information
360
+ public struct Structure {
361
+ let number: Int
362
+ }
363
+ """ ,
335
364
expectedResponses: [
336
- " 1️⃣ " : . error( . noDocumentation) ,
337
- " 2️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/numberPlusOne " ) ,
338
- " 3️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/Kind " ) ,
339
- " 4️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/Kind/first " ) ,
340
- " 5️⃣ " : . renderNode( kind: . symbol, path: " test/Structure/Kind/second " ) ,
341
- " 6️⃣ " : . error( . noDocumentation) ,
365
+ " 1️⃣ " : . renderNode( kind: . symbol, path: " test/Structure " )
342
366
]
343
367
)
344
368
}
0 commit comments