@@ -164,4 +164,36 @@ import Testing
164164 #expect( generated. contains ( " 17.0 " ) )
165165 #expect( generated. contains ( " var bar " ) )
166166 }
167+
168+ @Test ( " Parameter with attribute generates correct syntax " )
169+ func testParameterWithAttribute( ) throws {
170+ let function = Function ( " process " ) {
171+ Parameter ( name: " data " , type: " Data " )
172+ . attribute ( " escaping " )
173+ } _: {
174+ Variable ( . let, name: " result " , type: " String " , equals: " processed " )
175+ }
176+
177+ let generated = function. syntax. description
178+ #expect( generated. contains ( " @escaping " ) )
179+ #expect( generated. contains ( " data: Data " ) )
180+ #expect( generated. contains ( " func process " ) )
181+ }
182+
183+ @Test ( " Parameter with attribute arguments generates correct syntax " )
184+ func testParameterWithAttributeArguments( ) throws {
185+ let function = Function ( " validate " ) {
186+ Parameter ( name: " input " , type: " String " )
187+ . attribute ( " available " , arguments: [ " iOS " , " 17.0 " ] )
188+ } _: {
189+ Variable ( . let, name: " result " , type: " Bool " , equals: " true " )
190+ }
191+
192+ let generated = function. syntax. description
193+ #expect( generated. contains ( " @available " ) )
194+ #expect( generated. contains ( " iOS " ) )
195+ #expect( generated. contains ( " 17.0 " ) )
196+ #expect( generated. contains ( " input: String " ) )
197+ #expect( generated. contains ( " func validate " ) )
198+ }
167199}
0 commit comments