Small additional test for precedence

This commit is contained in:
Simon Binder 2021-11-14 12:17:25 +01:00
parent fad654a5aa
commit 05a8b9abf1
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,17 @@ void main() {
expect(expr, generates('(???) = (???)'));
});
test('generates parentheses for OR in AND', () {
final c =
GeneratedColumn<String>('c', 't', false, type: const StringType());
final expr =
(c.equals('A') | c.equals('B')) & (c.equals('C') | c.equals(''));
expect(
expr,
generates(
'(c = ? OR c = ?) AND (c = ? OR c = ?)', ['A', 'B', 'C', '']));
});
test('generates cast expressions', () {
const expr = CustomExpression<int>('c');