@@ -7,7 +7,6 @@ import SwiftSyntaxMacrosTestSupport
77import XCTest
88
99@testable import PluginCore
10- @testable import MacroPlugin
1110
1211final class CodableTests : XCTestCase {
1312
@@ -310,6 +309,42 @@ final class CodableTests: XCTestCase {
310309 }
311310}
312311
312+ #if canImport(MacroPlugin)
313+ @testable import MacroPlugin
314+
315+ let allMacros : [ String : Macro . Type ] = [
316+ " CodedAt " : MacroPlugin . CodedAt. self,
317+ " CodedIn " : MacroPlugin . CodedIn. self,
318+ " Default " : MacroPlugin . Default. self,
319+ " CodedBy " : MacroPlugin . CodedBy. self,
320+ " CodedAs " : MacroPlugin . CodedAs. self,
321+ " ContentAt " : MacroPlugin . ContentAt. self,
322+ " IgnoreCoding " : MacroPlugin . IgnoreCoding. self,
323+ " IgnoreDecoding " : MacroPlugin . IgnoreDecoding. self,
324+ " IgnoreEncoding " : MacroPlugin . IgnoreEncoding. self,
325+ " Codable " : MacroPlugin . Codable. self,
326+ " MemberInit " : MacroPlugin . MemberInit. self,
327+ " CodingKeys " : MacroPlugin . CodingKeys. self,
328+ " IgnoreCodingInitialized " : MacroPlugin . IgnoreCodingInitialized. self,
329+ ]
330+ #else
331+ let allMacros : [ String : Macro . Type ] = [
332+ " CodedAt " : CodedAt . self,
333+ " CodedIn " : CodedIn . self,
334+ " Default " : Default . self,
335+ " CodedBy " : CodedBy . self,
336+ " CodedAs " : CodedAs . self,
337+ " ContentAt " : ContentAt . self,
338+ " IgnoreCoding " : IgnoreCoding . self,
339+ " IgnoreDecoding " : IgnoreDecoding . self,
340+ " IgnoreEncoding " : IgnoreEncoding . self,
341+ " Codable " : Codable . self,
342+ " MemberInit " : MemberInit . self,
343+ " CodingKeys " : CodingKeys . self,
344+ " IgnoreCodingInitialized " : IgnoreCodingInitialized . self,
345+ ]
346+ #endif
347+
313348func assertMacroExpansion(
314349 _ originalSource: String ,
315350 expandedSource: String ,
@@ -321,25 +356,10 @@ func assertMacroExpansion(
321356 file: StaticString = #file,
322357 line: UInt = #line
323358) {
324- let macros : [ String : Macro . Type ] = [
325- " CodedAt " : MacroPlugin . CodedAt. self,
326- " CodedIn " : MacroPlugin . CodedIn. self,
327- " Default " : MacroPlugin . Default. self,
328- " CodedBy " : MacroPlugin . CodedBy. self,
329- " CodedAs " : MacroPlugin . CodedAs. self,
330- " ContentAt " : MacroPlugin . ContentAt. self,
331- " IgnoreCoding " : MacroPlugin . IgnoreCoding. self,
332- " IgnoreDecoding " : MacroPlugin . IgnoreDecoding. self,
333- " IgnoreEncoding " : MacroPlugin . IgnoreEncoding. self,
334- " Codable " : MacroPlugin . Codable. self,
335- " MemberInit " : MacroPlugin . MemberInit. self,
336- " CodingKeys " : MacroPlugin . CodingKeys. self,
337- " IgnoreCodingInitialized " : MacroPlugin . IgnoreCodingInitialized. self,
338- ]
339359 assertMacroExpansion (
340360 originalSource, expandedSource: expandedSource,
341361 diagnostics: diagnostics,
342- macroSpecs: macros . mapValues { value in
362+ macroSpecs: allMacros . mapValues { value in
343363 return MacroSpec ( type: value, conformances: conformances)
344364 } ,
345365 testModuleName: testModuleName, testFileName: testFileName,
0 commit comments