@@ -329,150 +329,6 @@ class SymbolGraphLoaderTests: XCTestCase {
329
329
XCTAssertEqual ( loader. decodingStrategy, . concurrentlyEachFileInBatches)
330
330
#endif
331
331
}
332
-
333
- func testInputWithMixedGraphFormats( ) throws {
334
- let tempURL = try createTemporaryDirectory ( )
335
-
336
- let mainGraph = ( url: tempURL. appendingPathComponent ( " A.symbols.json " ) ,
337
- content: makeSymbolGraphString ( moduleName: " A " ) )
338
-
339
- let emptyExtensionGraph = ( url
: tempURL
. appendingPathComponent ( " [email protected] " ) ,
340
- content: makeSymbolGraphString ( moduleName: " A " ) )
341
-
342
- let extensionBlockFormatExtensionGraph = ( url
: tempURL
. appendingPathComponent ( " [email protected] " ) ,
343
- content: makeSymbolGraphString ( moduleName: " A " , symbols: """
344
- {
345
- " kind " : {
346
- " identifier " : " swift.extension " ,
347
- " displayName " : " Extension "
348
- },
349
- " identifier " : {
350
- " precise " : " s:e:s:EBFfunction " ,
351
- " interfaceLanguage " : " swift "
352
- },
353
- " pathComponents " : [
354
- " EBF "
355
- ],
356
- " names " : {
357
- " title " : " EBF " ,
358
- },
359
- " swiftExtension " : {
360
- " extendedModule " : " A " ,
361
- " typeKind " : " struct "
362
- },
363
- " accessLevel " : " public "
364
- },
365
- {
366
- " kind " : {
367
- " identifier " : " swift.func " ,
368
- " displayName " : " Function "
369
- },
370
- " identifier " : {
371
- " precise " : " s:EBFfunction " ,
372
- " interfaceLanguage " : " swift "
373
- },
374
- " pathComponents " : [
375
- " EBF " ,
376
- " function "
377
- ],
378
- " names " : {
379
- " title " : " function " ,
380
- },
381
- " swiftExtension " : {
382
- " extendedModule " : " A " ,
383
- " typeKind " : " struct "
384
- },
385
- " accessLevel " : " public "
386
- }
387
- """ , relationships: """
388
- {
389
- " kind " : " memberOf " ,
390
- " source " : " s:EBFfunction " ,
391
- " target " : " s:e:s:EBFfunction " ,
392
- " targetFallback " : " A.EBF "
393
- },
394
- {
395
- " kind " : " extensionTo " ,
396
- " source " : " s:e:s:EBFfunction " ,
397
- " target " : " s:EBF " ,
398
- " targetFallback " : " A.EBF "
399
- }
400
- """ ) )
401
-
402
- let noExtensionBlockFormatExtensionGraph = ( url
: tempURL
. appendingPathComponent ( " [email protected] " ) ,
403
- content: makeSymbolGraphString ( moduleName: " A " , symbols: """
404
- {
405
- " kind " : {
406
- " identifier " : " swift.func " ,
407
- " displayName " : " Function "
408
- },
409
- " identifier " : {
410
- " precise " : " s:EBFfunction " ,
411
- " interfaceLanguage " : " swift "
412
- },
413
- " pathComponents " : [
414
- " EBF " ,
415
- " function "
416
- ],
417
- " names " : {
418
- " title " : " function " ,
419
- },
420
- " swiftExtension " : {
421
- " extendedModule " : " A " ,
422
- " typeKind " : " struct "
423
- },
424
- " accessLevel " : " public "
425
- }
426
- """ , relationships: """
427
- {
428
- " kind " : " memberOf " ,
429
- " source " : " s:EBFfunction " ,
430
- " target " : " s:EBF " ,
431
- " targetFallback " : " A.EBF "
432
- }
433
- """ ) )
434
-
435
- let allGraphs = [ mainGraph, emptyExtensionGraph, extensionBlockFormatExtensionGraph, noExtensionBlockFormatExtensionGraph]
436
-
437
- for graph in allGraphs {
438
- try XCTUnwrap ( graph. content. data ( using: . utf8) ) . write ( to: graph. url)
439
- }
440
-
441
- let validUndetermined = [ mainGraph, emptyExtensionGraph]
442
- var loader = try makeSymbolGraphLoader ( symbolGraphURLs: validUndetermined. map ( \. url) )
443
- try loader. loadAll ( )
444
- // by default, extension graphs should be associated with the extended graph
445
- XCTAssertEqual ( loader. unifiedGraphs. count, 2 )
446
-
447
- let validEBF = [ mainGraph, emptyExtensionGraph, extensionBlockFormatExtensionGraph]
448
- loader = try makeSymbolGraphLoader ( symbolGraphURLs: validEBF. map ( \. url) )
449
- try loader. loadAll ( )
450
- // found extension block symbols; extension graphs should be associated with the extending graph
451
- XCTAssertEqual ( loader. unifiedGraphs. count, 1 )
452
-
453
- let validNEBF = [ mainGraph, emptyExtensionGraph, noExtensionBlockFormatExtensionGraph]
454
- loader = try makeSymbolGraphLoader ( symbolGraphURLs: validNEBF. map ( \. url) )
455
- try loader. loadAll ( )
456
- // found no extension block symbols; extension graphs should be associated with the extended graph
457
- XCTAssertEqual ( loader. unifiedGraphs. count, 3 )
458
-
459
- let invalid = allGraphs
460
- loader = try makeSymbolGraphLoader ( symbolGraphURLs: invalid. map ( \. url) )
461
- // found non-empty extension graphs with and without extension block symbols -> should throw
462
- XCTAssertThrowsError ( try loader. loadAll ( ) ,
463
- " SymbolGraphLoader should throw when encountering a collection of symbol graph files, where some do and some don't use the extension block format " ) { error in
464
- XCTAssertFalse ( error. localizedDescription. contains ( mainGraph. url. absoluteString) )
465
- XCTAssertFalse ( error. localizedDescription. contains ( emptyExtensionGraph. url. absoluteString) )
466
- XCTAssert ( error. localizedDescription. contains ( """
467
- Symbol graph files with extension declarations:
468
- \( extensionBlockFormatExtensionGraph. url. absoluteString)
469
- """ ) )
470
- XCTAssert ( error. localizedDescription. contains ( """
471
- Symbol graph files without extension declarations:
472
- \( noExtensionBlockFormatExtensionGraph. url. absoluteString)
473
- """ ) )
474
- }
475
- }
476
332
477
333
func testConfiguresSymbolGraphs( ) throws {
478
334
let tempURL = try createTemporaryDirectory ( )
0 commit comments