diff --git a/drift/CHANGELOG.md b/drift/CHANGELOG.md index 4f8ef99b..40970c79 100644 --- a/drift/CHANGELOG.md +++ b/drift/CHANGELOG.md @@ -6,6 +6,7 @@ which tables are affected by the custom statement. - For `STRICT` tables in drift files declaring a `ANY` column, drift will now generate a mapping to the new `DriftAny` type. +- Add `likeExp` to generate `LIKE` expression with any comparison expression. - Fix `UNIQUE` keys declared in drift files being written twice. - Fix `customConstraints` not appearing in dumped database schema files. - Work-around an issue causing complex migrations via `Migrator.alterTable` not to diff --git a/drift/test/database/expressions/text_test.dart b/drift/test/database/expressions/text_test.dart index 7e26f7dc..e9fc9e1c 100644 --- a/drift/test/database/expressions/text_test.dart +++ b/drift/test/database/expressions/text_test.dart @@ -1,20 +1,15 @@ import 'package:drift/drift.dart'; import 'package:test/test.dart'; -import '../../generated/todos.dart'; import '../../test_utils/test_utils.dart'; void main() { const expression = CustomExpression('col', precedence: Precedence.primary); - final db = TodoDb(); test('generates like expressions', () { - final ctx = GenerationContext.fromDb(db); - expression.like('pattern').writeInto(ctx); - - expect(ctx.sql, 'col LIKE ?'); - expect(ctx.boundVariables, ['pattern']); + expect(expression.like('pattern'), generates('col LIKE ?', ['pattern'])); + expect(expression.likeExp(expression), generates('col LIKE col')); }); test('generates regexp expressions', () {