Add trailing commas for readability

This commit is contained in:
tibotix 2023-11-17 18:04:21 +01:00
parent 26fd4bf11e
commit ff11a2a757
No known key found for this signature in database
GPG Key ID: 96DF02FF50AC54C7
1 changed files with 37 additions and 31 deletions

View File

@ -28,47 +28,53 @@ void main() {
test('parses updates with column-name-list and subquery', () { test('parses updates with column-name-list and subquery', () {
testStatement( testStatement(
''' '''
UPDATE foo UPDATE foo
SET (a, b) = (SELECT b, a FROM bar AS b WHERE b.id=foo.id); SET (a, b) = (SELECT b, a FROM bar AS b WHERE b.id=foo.id);
''', ''',
UpdateStatement(table: TableReference('foo'), set: [ UpdateStatement(table: TableReference('foo'), set: [
MultiColumnSetComponent( MultiColumnSetComponent(
columns: [Reference(columnName: 'a'), Reference(columnName: 'b')], columns: [Reference(columnName: 'a'), Reference(columnName: 'b')],
rowValue: SubQuery( rowValue: SubQuery(
select: SelectStatement( select: SelectStatement(
columns: [ columns: [
ExpressionResultColumn( ExpressionResultColumn(
expression: Reference(columnName: 'b'), expression: Reference(columnName: 'b'),
), ),
ExpressionResultColumn( ExpressionResultColumn(
expression: Reference(columnName: 'a'), expression: Reference(columnName: 'a'),
), ),
], ],
from: TableReference('bar', as: 'b'), from: TableReference('bar', as: 'b'),
where: BinaryExpression( where: BinaryExpression(
Reference(entityName: 'b', columnName: 'id'), Reference(entityName: 'b', columnName: 'id'),
token(TokenType.equal), token(TokenType.equal),
Reference(entityName: 'foo', columnName: 'id'), Reference(entityName: 'foo', columnName: 'id'),
)))) ),
])); ),
),
)
]),
);
}); });
test('parses updates with column-name-list and scalar rowValues', () { test('parses updates with column-name-list and scalar rowValues', () {
testStatement( testStatement(
''' '''
UPDATE foo UPDATE foo
SET (a, b) = (b, 3+4); SET (a, b) = (b, 3+4);
''', ''',
UpdateStatement(table: TableReference('foo'), set: [ UpdateStatement(table: TableReference('foo'), set: [
MultiColumnSetComponent( MultiColumnSetComponent(
columns: [Reference(columnName: 'a'), Reference(columnName: 'b')], columns: [Reference(columnName: 'a'), Reference(columnName: 'b')],
rowValue: Tuple(expressions: [ rowValue: Tuple(expressions: [
Reference(columnName: "b"), Reference(columnName: "b"),
BinaryExpression(NumericLiteral(3), token(TokenType.plus), BinaryExpression(
NumericLiteral(4)), NumericLiteral(3), token(TokenType.plus), NumericLiteral(4)),
], usedAsRowValue: true)) ], usedAsRowValue: true),
])); )
]),
);
}); });
test('parses updates with FROM clause', () { test('parses updates with FROM clause', () {