@@ -42,7 +42,9 @@ void main() {
4242 }
4343
4444 Future <RemoteDatabase > requestDatabase (
45- String name, DatabaseImplementation implementation) async {
45+ String name,
46+ DatabaseImplementation implementation,
47+ ) async {
4648 final conn = await connectTo (localEnv);
4749 return await conn.requestDatabase (
4850 wasmUri: sqlite3WasmUri,
@@ -54,41 +56,53 @@ void main() {
5456 }
5557
5658 test ('can open database' , () async {
57- final db =
58- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
59+ final db = await requestDatabase (
60+ 'foo' ,
61+ DatabaseImplementation .inMemoryShared,
62+ );
5963
6064 final results = await db.select ('SELECT 1 as r;' );
6165 expect (results.result, [
62- {'r' : 1 }
66+ {'r' : 1 },
6367 ]);
6468 });
6569
6670 test ('can share database between clients' , () async {
67- final a =
68- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
69- final b =
70- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
71+ final a = await requestDatabase (
72+ 'foo' ,
73+ DatabaseImplementation .inMemoryShared,
74+ );
75+ final b = await requestDatabase (
76+ 'foo' ,
77+ DatabaseImplementation .inMemoryShared,
78+ );
7179 await a.execute ('CREATE TABLE foo (bar TEXT);' );
7280 await b.execute ('INSERT INTO foo DEFAULT VALUES' );
7381 final results = await a.select ('SELECT * FROM foo' );
7482 expect (results.result, hasLength (1 ));
7583 });
7684
7785 test ('releases resources for closed databases' , () async {
78- final a =
79- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
86+ final a = await requestDatabase (
87+ 'foo' ,
88+ DatabaseImplementation .inMemoryShared,
89+ );
8090 await a.execute ('CREATE TABLE foo (bar TEXT);' );
8191 await a.dispose ();
8292
83- final b =
84- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
93+ final b = await requestDatabase (
94+ 'foo' ,
95+ DatabaseImplementation .inMemoryShared,
96+ );
8597 // This would fail if the in-memory database were reused.
8698 await b.execute ('CREATE TABLE foo (bar TEXT);' );
8799 });
88100
89101 test ('returns autocommit state' , () async {
90- final a =
91- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
102+ final a = await requestDatabase (
103+ 'foo' ,
104+ DatabaseImplementation .inMemoryShared,
105+ );
92106 var res = await a.execute ('BEGIN' );
93107 expect (res.autocommit, isFalse);
94108
@@ -97,18 +111,24 @@ void main() {
97111 });
98112
99113 test ('returns last insert rowid' , () async {
100- final a =
101- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
114+ final a = await requestDatabase (
115+ 'foo' ,
116+ DatabaseImplementation .inMemoryShared,
117+ );
102118 await a.execute ('CREATE TABLE foo (bar TEXT);' );
103119
104- final insert = await a
105- .execute ('INSERT INTO foo (bar) VALUES (?)' , parameters: ['test' ]);
120+ final insert = await a.execute (
121+ 'INSERT INTO foo (bar) VALUES (?)' ,
122+ parameters: ['test' ],
123+ );
106124 expect (insert.lastInsertRowid, 1 );
107125 });
108126
109127 test ('check in transaction' , () async {
110- final a =
111- await requestDatabase ('foo' , DatabaseImplementation .inMemoryShared);
128+ final a = await requestDatabase (
129+ 'foo' ,
130+ DatabaseImplementation .inMemoryShared,
131+ );
112132 await a.execute ('CREATE TABLE foo (bar TEXT);' );
113133
114134 await a.execute ('BEGIN' );
@@ -119,8 +139,10 @@ void main() {
119139 );
120140 await a.execute ('COMMIT' );
121141
122- await expectLater (a.execute ('SELECT 1' , checkInTransaction: true ),
123- throwsA (isA <RemoteException >()));
142+ await expectLater (
143+ a.execute ('SELECT 1' , checkInTransaction: true ),
144+ throwsA (isA <RemoteException >()),
145+ );
124146 });
125147
126148 group ('locks' , () {
@@ -162,7 +184,8 @@ void main() {
162184 await a.requestLock ((token) async {
163185 // The token needs to be passed for statements to work.
164186 queryResult.complete (
165- a.select ('SELECT 1' ).whenComplete (() => hasResults = true ));
187+ a.select ('SELECT 1' ).whenComplete (() => hasResults = true ),
188+ );
166189 expect (hasResults, isFalse);
167190 await pumpEventQueue ();
168191 expect (hasResults, isFalse);
@@ -263,13 +286,19 @@ void main() {
263286final class _TestController extends DatabaseController {
264287 @override
265288 Future <JSAny ?> handleCustomRequest (
266- ClientConnection connection, JSAny ? request) {
289+ ClientConnection connection,
290+ JSAny ? request,
291+ ) {
267292 throw UnimplementedError ();
268293 }
269294
270295 @override
271- Future <WorkerDatabase > openDatabase (WasmSqlite3 sqlite3, String path,
272- String vfs, JSAny ? additionalData) async {
296+ Future <WorkerDatabase > openDatabase (
297+ WasmSqlite3 sqlite3,
298+ String path,
299+ String vfs,
300+ JSAny ? additionalData,
301+ ) async {
273302 return _TestDatabase (sqlite3.open (path, vfs: vfs));
274303 }
275304}
@@ -282,7 +311,9 @@ final class _TestDatabase extends WorkerDatabase {
282311
283312 @override
284313 Future <JSAny ?> handleCustomRequest (
285- ClientConnection connection, JSAny ? request) {
314+ ClientConnection connection,
315+ JSAny ? request,
316+ ) {
286317 throw UnimplementedError ();
287318 }
288319}
0 commit comments