@@ -175,9 +175,9 @@ final class VariableTests: XCTestCase {
175
175
}
176
176
177
177
func testComputedProperty( ) throws {
178
- let testCases : [ UInt : ( VariableDeclSyntax , String ) ] = [
178
+ let testCases : [ UInt : ( VariableDeclSyntax , String ) ] = try [
179
179
#line: (
180
- VariableDeclSyntax ( name : " test " , type : TypeAnnotationSyntax ( type : TypeSyntax ( " Int " ) ) ) {
180
+ VariableDeclSyntax ( " var test: Int" ) {
181
181
SequenceExprSyntax {
182
182
IntegerLiteralExprSyntax ( 4 )
183
183
BinaryOperatorExprSyntax ( text: " + " )
@@ -208,8 +208,8 @@ final class VariableTests: XCTestCase {
208
208
}
209
209
}
210
210
211
- func testAccessorList( ) {
212
- let buildable = VariableDeclSyntax ( name : " test " , type : TypeAnnotationSyntax ( type : TypeSyntax ( " Int " ) ) ) {
211
+ func testAccessorList( ) throws {
212
+ let buildable = try VariableDeclSyntax ( " var test: Int" ) {
213
213
AccessorDeclSyntax ( accessorKind: . keyword( . get) ) {
214
214
SequenceExprSyntax {
215
215
IntegerLiteralExprSyntax ( 4 )
@@ -235,8 +235,8 @@ final class VariableTests: XCTestCase {
235
235
)
236
236
}
237
237
238
- func testAttributedVariables( ) {
239
- let testCases : [ UInt : ( VariableDeclSyntax , String ) ] = [
238
+ func testAttributedVariables( ) throws {
239
+ let testCases : [ UInt : ( VariableDeclSyntax , String ) ] = try [
240
240
#line: (
241
241
VariableDeclSyntax (
242
242
attributes: AttributeListSyntax { AttributeSyntax ( attributeName: TypeSyntax ( " Test " ) ) } ,
@@ -249,11 +249,7 @@ final class VariableTests: XCTestCase {
249
249
"""
250
250
) ,
251
251
#line: (
252
- VariableDeclSyntax (
253
- attributes: AttributeListSyntax { AttributeSyntax ( attributeName: TypeSyntax ( " Test " ) ) } ,
254
- name: " y " ,
255
- type: TypeAnnotationSyntax ( type: TypeSyntax ( " String " ) )
256
- ) {
252
+ VariableDeclSyntax ( " @Test var y: String " ) {
257
253
StringLiteralExprSyntax ( content: " Hello world! " )
258
254
} ,
259
255
"""
@@ -263,16 +259,7 @@ final class VariableTests: XCTestCase {
263
259
"""
264
260
) ,
265
261
#line: (
266
- VariableDeclSyntax (
267
- attributes: AttributeListSyntax {
268
- AttributeSyntax ( " WithArgs " ) {
269
- TupleExprElementSyntax ( expression: ExprSyntax ( " value1 " ) )
270
- TupleExprElementSyntax ( label: " label " , expression: ExprSyntax ( " value2 " ) )
271
- }
272
- } ,
273
- name: " z " ,
274
- type: TypeAnnotationSyntax ( type: TypeSyntax ( " Float " ) )
275
- ) {
262
+ VariableDeclSyntax ( " @WithArgs(value1, label: value2) var z: Float " ) {
276
263
FloatLiteralExprSyntax ( 0.0 )
277
264
} ,
278
265
"""
0 commit comments