@@ -1135,6 +1135,47 @@ class PathHierarchyTests: XCTestCase {
1135
1135
}
1136
1136
}
1137
1137
1138
+ func testArticleWithDisambiguationLookingName( ) throws {
1139
+ try XCTSkipUnless ( LinkResolutionMigrationConfiguration . shouldUseHierarchyBasedLinkResolver)
1140
+ let exampleDocumentation = Folder ( name: " MyKit.docc " , content: [
1141
+ CopyOfFile ( original: Bundle . module. url ( forResource: " BaseKit.symbols " , withExtension: " json " , subdirectory: " Test Resources " ) !) ,
1142
+ InfoPlist ( displayName: " BaseKit " , identifier: " com.test.BaseKit " ) ,
1143
+ TextFile ( name: " basekit.md " , utf8Content: """
1144
+ # ``BaseKit``
1145
+
1146
+ Curate an article that look like a disambiguated symbol
1147
+
1148
+ ## Topics
1149
+
1150
+ - <doc:OtherStruct>
1151
+ - <doc:OtherStruct-abcd>
1152
+ """ ) ,
1153
+ TextFile ( name: " OtherStruct-abcd.md " , utf8Content: """
1154
+ # Some article
1155
+
1156
+ An article with a file name that resembles a disambiguated symbol name.
1157
+ """ ) ,
1158
+ ] )
1159
+ let tempURL = try createTemporaryDirectory ( )
1160
+ let bundleURL = try exampleDocumentation. write ( inside: tempURL)
1161
+
1162
+ do {
1163
+ let ( _, _, context) = try loadBundle ( from: bundleURL)
1164
+ XCTAssert ( context. problems. isEmpty, " Unexpected problems: \( context. problems. map ( \. localizedDescription) ) " )
1165
+
1166
+ let tree = try XCTUnwrap ( context. hierarchyBasedLinkResolver? . pathHierarchy)
1167
+
1168
+ let baseKitID = try tree. find ( path: " /BaseKit " , onlyFindSymbols: true )
1169
+
1170
+ XCTAssertEqual ( try tree. findSymbol ( path: " OtherStruct " , parent: baseKitID) . identifier. precise, " s:7BaseKit11OtherStructV " )
1171
+
1172
+ let articleID = try tree. find ( path: " OtherStruct-abcd " , parent: baseKitID, onlyFindSymbols: false )
1173
+ let articleNode = try XCTUnwrap ( tree. lookup [ articleID] )
1174
+ XCTAssertNil ( articleNode. symbol)
1175
+ XCTAssertEqual ( articleNode. name, " OtherStruct-abcd " )
1176
+ }
1177
+ }
1178
+
1138
1179
func testPartialSymbolGraphPaths( ) throws {
1139
1180
try XCTSkipUnless ( LinkResolutionMigrationConfiguration . shouldUseHierarchyBasedLinkResolver)
1140
1181
let symbolPaths = [
0 commit comments