@@ -127,8 +127,26 @@ class GraphCollectorTests: XCTestCase {
127127 mixins: [ : ] )
128128 ] ,
129129 relationships: [ ] )
130+
131+ var ( extensionName
, extensionIsMain
) = GraphCollector . moduleNameFor ( a_At_B
, at
: . init
( fileURLWithPath
: " [email protected] " ) ) 132+ XCTAssertFalse ( extensionIsMain)
133+ XCTAssertEqual ( " B " , extensionName)
134+
135+ // "A@B" style graph, with extension of B in module A, using shortened name scheme.
136+ let a_At_B_Shortened = SymbolGraph ( metadata: . init( formatVersion: . init( major: 1 , minor: 0 , patch: 0 ) , generator: " unit-test " ) ,
137+ module: . init( name: " A " , platform: . init( ) , extended: " B " ) ,
138+ symbols: [
139+ . init( identifier: . init( precise: " s:BBAatB " , interfaceLanguage: " swift " ) ,
140+ names: . init( title: " AatB " , navigator: nil , subHeading: nil , prose: nil ) ,
141+ pathComponents: [ " B " , " AatB " ] ,
142+ docComment: nil ,
143+ accessLevel: . init( rawValue: " public " ) ,
144+ kind: . init( parsedIdentifier: . class, displayName: " Class " ) ,
145+ mixins: [ : ] )
146+ ] ,
147+ relationships: [ ] )
130148
131- let ( extensionName, extensionIsMain) = GraphCollector . moduleNameFor ( a_At_B , at: . init( fileURLWithPath: " A@B .symbols.json" ) )
149+ ( extensionName, extensionIsMain) = GraphCollector . moduleNameFor ( a_At_B_Shortened , at: . init( fileURLWithPath: " ABCDEF123456 .symbols.json" ) )
132150 XCTAssertFalse ( extensionIsMain)
133151 XCTAssertEqual ( " B " , extensionName)
134152
@@ -186,5 +204,12 @@ class GraphCollectorTests: XCTestCase {
186204 let ( extendedB
, extendedBIsMain
) = GraphCollector . moduleNameFor ( a_At_B
, at
: . init
( fileURLWithPath
: " [email protected] " ) ) 187205 XCTAssertFalse ( extendedBIsMain)
188206 XCTAssertEqual ( " B " , extendedB)
207+
208+ // "A@B" style graph, with extension of B in module A, using shortened name scheme.
209+ var a_At_B_ShortenedFileName = a_At_B
210+ a_At_B_ShortenedFileName. module. extended = " B "
211+ let ( extendedBShortForm
, extendedBIsMainShortForm
) = GraphCollector . moduleNameFor ( a_At_B
, at
: . init
( fileURLWithPath
: " [email protected] " ) ) 212+ XCTAssertFalse ( extendedBIsMainShortForm)
213+ XCTAssertEqual ( " B " , extendedBShortForm)
189214 }
190215}
0 commit comments