@@ -615,6 +615,47 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
615
615
)
616
616
}
617
617
618
+ func testDoesNotEmitObjectiveCRelationshipsForTopicThatOnlyHasSwiftRelationships( ) throws {
619
+ try assertMultiVariantSymbol (
620
+ configureContext: { context, _ in
621
+
622
+ // Set up an Objective-C title for MyProtocol.
623
+ let myFunctionNode = try context. entity (
624
+ with: ResolvedTopicReference (
625
+ bundleIdentifier: " org.swift.docc.example " ,
626
+ path: " /documentation/MyKit/MyProtocol " ,
627
+ fragment: nil ,
628
+ sourceLanguage: . swift
629
+ )
630
+ )
631
+
632
+ let myProtocol = try XCTUnwrap ( myFunctionNode. semantic as? Symbol )
633
+ myProtocol. titleVariants [ . objectiveC] = " MyProtocol "
634
+ } ,
635
+ configureSymbol: { symbol in
636
+ symbol. relationshipsVariants [ . swift] = makeRelationshipSection (
637
+ kind: . inheritedBy,
638
+ path: " /documentation/MyKit/MyClass/myFunction() "
639
+ )
640
+
641
+ symbol. relationshipsVariants [ . objectiveC] = nil
642
+ } ,
643
+ assertOriginalRenderNode: { renderNode in
644
+ XCTAssertEqual ( renderNode. relationshipSections. count, 1 )
645
+ let relationshipSection = try XCTUnwrap ( renderNode. relationshipSections. first)
646
+ XCTAssertEqual ( relationshipSection. title, " Inherited By " )
647
+
648
+ XCTAssertEqual (
649
+ relationshipSection. identifiers,
650
+ [ " doc://org.swift.docc.example/documentation/MyKit/MyClass/myFunction() " ]
651
+ )
652
+ } ,
653
+ assertAfterApplyingVariant: { renderNode in
654
+ XCTAssert ( renderNode. relationshipSections. isEmpty)
655
+ }
656
+ )
657
+ }
658
+
618
659
func testTopicsSectionVariants( ) throws {
619
660
try assertMultiVariantSymbol (
620
661
configureContext: { context, reference in
0 commit comments