@@ -33,9 +33,57 @@ import SWBMacro
3333 swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
3434 )
3535 #expect( frameworkArgs == [ ] )
36+
37+ let publicArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
38+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . public) ,
39+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
40+ )
41+ #expect( publicArgs == [ " -symbol-graph-minimum-access-level " , " public " ] )
42+
43+ let privateArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
44+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . private) ,
45+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
46+ )
47+ #expect( privateArgs == [ " -symbol-graph-minimum-access-level " , " private " ] )
48+
49+ let filePrivateArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
50+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . fileprivate) ,
51+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
52+ )
53+ #expect( filePrivateArgs == [ " -symbol-graph-minimum-access-level " , " fileprivate " ] )
54+
55+ let internalArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
56+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . internal) ,
57+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
58+ )
59+ #expect( internalArgs == [ " -symbol-graph-minimum-access-level " , " internal " ] )
60+
61+ let openArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
62+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . open) ,
63+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
64+ )
65+ #expect( openArgs == [ " -symbol-graph-minimum-access-level " , " open " ] )
66+
67+ let packageArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
68+ try mockApplicationBuildContext ( application: false , minimumAccessLevel: . package ) ,
69+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
70+ )
71+ #expect( packageArgs == [ " -symbol-graph-minimum-access-level " , " package " ] )
72+
73+ let prettyPrintArgs = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
74+ try mockApplicationBuildContext ( application: false , prettyPrint: true ) ,
75+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
76+ )
77+ #expect( prettyPrintArgs == [ " -symbol-graph-pretty-print " ] )
78+
79+ let skipSynthesizedMembers = await DocumentationCompilerSpec . additionalSymbolGraphGenerationArgs (
80+ try mockApplicationBuildContext ( application: false , skipSynthesizedMembers: true ) ,
81+ swiftCompilerInfo: try mockSwiftCompilerSpec ( swiftVersion: " 5.6 " , swiftTag: " swiftlang-5.6.0.0 " )
82+ )
83+ #expect( skipSynthesizedMembers == [ " -symbol-graph-skip-synthesized-members " ] )
3684 }
3785
38- private func mockApplicationBuildContext( application: Bool ) async throws -> CommandBuildContext {
86+ private func mockApplicationBuildContext( application: Bool , minimumAccessLevel : DoccMinimumAccessLevel = . none , prettyPrint : Bool = false , skipSynthesizedMembers : Bool = false ) async throws -> CommandBuildContext {
3987 let core = try await getCore ( )
4088
4189 let producer = try MockCommandProducer (
@@ -49,6 +97,16 @@ import SWBMacro
4997 mockTable. push ( BuiltinMacros . MACH_O_TYPE, literal: " mh_execute " )
5098 }
5199
100+ mockTable. push ( BuiltinMacros . DOCC_MINIMUM_ACCESS_LEVEL, literal: minimumAccessLevel)
101+
102+ if prettyPrint {
103+ mockTable. push ( BuiltinMacros . DOCC_PRETTY_PRINT, literal: true )
104+ }
105+
106+ if skipSynthesizedMembers {
107+ mockTable. push ( BuiltinMacros . DOCC_SKIP_SYNTHESIZED_MEMBERS, literal: skipSynthesizedMembers)
108+ }
109+
52110 let mockScope = MacroEvaluationScope ( table: mockTable)
53111
54112 return CommandBuildContext ( producer: producer, scope: mockScope, inputs: [ ] )
0 commit comments