@@ -195,7 +195,10 @@ struct SymbolQueries:UnidocDatabaseTestBattery
195
195
tests. expect ( tree. rows ..?
196
196
[
197
197
. init(
198
- shoot: . init( stem: " BarbieCore Getting-Started " ) ,
198
+ shoot: . init( stem: " BarbieCore External-links " ) ,
199
+ type: . text( " External links " ) ) ,
200
+ . init(
201
+ shoot: . init( stem: " BarbieCore Getting-started " ) ,
199
202
type: . text( " Getting started " ) ) ,
200
203
. init(
201
204
shoot: . init( stem: " BarbieCore Barbie " ) ,
@@ -231,7 +234,7 @@ struct SymbolQueries:UnidocDatabaseTestBattery
231
234
for case (let tests? , let path, let expected) in
232
235
[
233
236
(
234
- tests / " Barbie " / " Dreamhouse " ,
237
+ tests / " Barbie " / " Dreamhouse " as TestGroup ? ,
235
238
[ " barbiecore " , " barbie " , " dreamhouse " ] [ ... ] ,
236
239
[
237
240
" Int " : [ 1 ] ,
@@ -243,7 +246,7 @@ struct SymbolQueries:UnidocDatabaseTestBattery
243
246
] as [ String : [ Int ] ]
244
247
) ,
245
248
(
246
- tests / " Barbie " / " Dreamhouse " / " Keys " ,
249
+ tests / " Barbie " / " Dreamhouse " / " Keys " as TestGroup ? ,
247
250
[ " barbiecore " , " barbie " , " dreamhouse " , " keys " ] [ ... ] ,
248
251
[
249
252
" Int " : [ 1 ] ,
@@ -331,15 +334,14 @@ struct SymbolQueries:UnidocDatabaseTestBattery
331
334
}
332
335
}
333
336
}
334
- /// The symbol graph linker should have mangled the space in `Getting Started .md`
337
+ /// The symbol graph linker should have mangled the space in `Getting started .md`
335
338
/// into a hyphen.
336
339
if let tests: TestGroup = tests / " Barbie " / " GettingStarted "
337
340
{
338
341
let query : Unidoc . VertexQuery < Unidoc . LookupAdjacent > = . init(
339
342
" swift-malibu " , [ " barbiecore " , " getting-started " ] )
340
343
await tests. do
341
344
{
342
-
343
345
if let output: Unidoc . VertexOutput = tests. expect (
344
346
value: try await session. query ( database: unidoc. id, with: query) ) ,
345
347
let _: Unidoc . AnyVertex = tests. expect (
@@ -349,6 +351,44 @@ struct SymbolQueries:UnidocDatabaseTestBattery
349
351
}
350
352
}
351
353
354
+ if let tests: TestGroup = tests / " Barbie " / " ExternalLinks "
355
+ {
356
+ let query : Unidoc . VertexQuery < Unidoc . LookupAdjacent > = . init(
357
+ " swift-malibu " , [ " barbiecore " , " external-links " ] )
358
+ await tests. do
359
+ {
360
+ if let output: Unidoc . VertexOutput = tests. expect (
361
+ value: try await session. query ( database: unidoc. id, with: query) ) ,
362
+ let vertex: Unidoc . AnyVertex = tests. expect (
363
+ value: output. principal? . vertex) ,
364
+ let prose: Unidoc . Passage = tests. expect (
365
+ value: vertex. overview)
366
+ {
367
+ // TODO: We should be optimizing away duplicate outlines.
368
+ tests. expect ( prose. outlines. count ==? 4 )
369
+ tests. expect ( prose. outlines [ ..< 3 ] ..? [
370
+ . link( https: " en.wikipedia.org/wiki/Main_Page " , safe: true ) ,
371
+ . link( https: " en.wikipedia.org/wiki/Main_Page " , safe: true ) ,
372
+ . link( https: " liberationnews.org " , safe: false ) ,
373
+ ] )
374
+
375
+ guard
376
+ case . path( let text, let path) = prose. outlines [ 3 ]
377
+ else
378
+ {
379
+ tests. expect ( value: nil as [ Unidoc . Scalar ] ? )
380
+ return
381
+ }
382
+
383
+ // TODO: This is not a bug, but it is a missed optimization opportunity.
384
+ // We do not need to resolve the two leading path components, as they will
385
+ // never be shown to the user.
386
+ tests. expect ( text ==? " swift string index " )
387
+ tests. expect ( path. count ==? 3 )
388
+ }
389
+ }
390
+ }
391
+
352
392
if let tests: TestGroup = tests / " SeeAlso "
353
393
{
354
394
if let test: TestCase = . init( tests / " GeneratedFromTopics " ,
0 commit comments