From 05a8b9abf1952b22d7cbeb8d56a88b207968710f Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Sun, 14 Nov 2021 12:17:25 +0100 Subject: [PATCH] Small additional test for precedence --- drift/test/expressions/expression_test.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drift/test/expressions/expression_test.dart b/drift/test/expressions/expression_test.dart index d03d9f29..03afcd7f 100644 --- a/drift/test/expressions/expression_test.dart +++ b/drift/test/expressions/expression_test.dart @@ -27,6 +27,17 @@ void main() { expect(expr, generates('(???) = (???)')); }); + test('generates parentheses for OR in AND', () { + final c = + GeneratedColumn('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('c');