@@ -24,6 +24,16 @@ import SwiftSyntaxMacroExpansion
2424import SwiftSyntaxMacrosTestSupport
2525import XCTest
2626
27+ fileprivate struct NoOpMemberMacro : MemberMacro {
28+ static func expansion(
29+ of node: AttributeSyntax ,
30+ providingMembersOf declaration: some DeclGroupSyntax ,
31+ in context: some MacroExpansionContext
32+ ) throws -> [ DeclSyntax ] {
33+ return [ ]
34+ }
35+ }
36+
2737final class MemberMacroTests : XCTestCase {
2838 private let indentationWidth : Trivia = . spaces( 2 )
2939
@@ -103,16 +113,6 @@ final class MemberMacroTests: XCTestCase {
103113 }
104114
105115 func testCommentAroundeAttachedMacro( ) {
106- struct TestMacro : MemberMacro {
107- static func expansion(
108- of node: AttributeSyntax ,
109- providingMembersOf declaration: some DeclGroupSyntax ,
110- in context: some MacroExpansionContext
111- ) throws -> [ DeclSyntax ] {
112- return [ ]
113- }
114- }
115-
116116 assertMacroExpansion (
117117 """
118118 /// Some doc comment
@@ -128,7 +128,47 @@ final class MemberMacroTests: XCTestCase {
128128 var value: Int
129129 }
130130 """ ,
131- macros: [ " Test " : TestMacro . self] ,
131+ macros: [ " Test " : NoOpMemberMacro . self] ,
132+ indentationWidth: indentationWidth
133+ )
134+ }
135+
136+ func testStructVariableDeclWithMultipleBindings( ) {
137+ assertMacroExpansion (
138+ """
139+ @Test
140+ struct S {
141+ var x: Int, y: Int
142+ }
143+ """ ,
144+ expandedSource: """
145+ struct S {
146+ var x: Int, y: Int
147+ }
148+ """ ,
149+ macros: [ " Test " : NoOpMemberMacro . self] ,
150+ indentationWidth: indentationWidth
151+ )
152+ }
153+
154+ func testNestedStructVariableDeclWithMultipleBindings( ) {
155+ assertMacroExpansion (
156+ """
157+ @Test
158+ struct Q {
159+ struct R {
160+ var i: Int, j: Int
161+ }
162+ }
163+ """ ,
164+ expandedSource: """
165+ struct Q {
166+ struct R {
167+ var i: Int, j: Int
168+ }
169+ }
170+ """ ,
171+ macros: [ " Test " : NoOpMemberMacro . self] ,
132172 indentationWidth: indentationWidth
133173 )
134174 }
0 commit comments