@@ -6,7 +6,6 @@ import 'dart:async';
6
6
import 'package:logging/logging.dart' ;
7
7
import 'package:observe/observe.dart' ;
8
8
import 'package:observe/src/dirty_check.dart' as dirty_check;
9
- import 'package:unittest/unittest.dart' ;
10
9
import 'observe_test_utils.dart' ;
11
10
12
11
import 'package:observe/mirrors_used.dart' as mu; // make test smaller.
@@ -15,7 +14,7 @@ import 'package:smoke/mirrors.dart';
15
14
/// Uses [mu] .
16
15
main () {
17
16
useMirrors ();
18
- dirtyCheckZone (). run ( _tests);
17
+ _tests ( );
19
18
}
20
19
21
20
void _tests () {
@@ -50,8 +49,9 @@ void _tests() {
50
49
var maxNumIterations = dirty_check.MAX_DIRTY_CHECK_CYCLES ;
51
50
52
51
var x = new WatcherModel (0 );
53
- var sub = x.changes.listen (expectAsync ((_) { x.value++ ; },
54
- count: maxNumIterations));
52
+ var sub = x.changes.listen (expectAsync ((_) {
53
+ x.value++ ;
54
+ }, count: maxNumIterations));
55
55
x.value = 1 ;
56
56
Observable .dirtyCheck ();
57
57
expect (x.value, maxNumIterations + 1 );
@@ -89,7 +89,7 @@ void _observeTests(createModel(x)) {
89
89
});
90
90
91
91
test ('handle future result' , () {
92
- var callback = expectAsync ((){});
92
+ var callback = expectAsync (() {});
93
93
return new Future (callback);
94
94
});
95
95
@@ -144,7 +144,7 @@ void _observeTests(createModel(x)) {
144
144
145
145
verifyRecords (records) {
146
146
expectPropertyChanges (records, watch ? 1 : 2 );
147
- };
147
+ }
148
148
149
149
subs.add (t.changes.listen (expectAsync (verifyRecords)));
150
150
subs.add (t.changes.listen (expectAsync (verifyRecords)));
@@ -156,7 +156,9 @@ void _observeTests(createModel(x)) {
156
156
test ('async processing model' , () {
157
157
var t = createModel (123 );
158
158
var records = [];
159
- subs.add (t.changes.listen ((r) { records.addAll (r); }));
159
+ subs.add (t.changes.listen ((r) {
160
+ records.addAll (r);
161
+ }));
160
162
t.value = 41 ;
161
163
t.value = 42 ;
162
164
expectChanges (records, [], reason: 'changes delived async' );
@@ -167,7 +169,6 @@ void _observeTests(createModel(x)) {
167
169
168
170
t.value = 777 ;
169
171
expectChanges (records, [], reason: 'changes delived async' );
170
-
171
172
}).then (newMicrotask).then ((_) {
172
173
expectPropertyChanges (records, 1 );
173
174
@@ -210,7 +211,9 @@ void _observeTests(createModel(x)) {
210
211
test ('cannot modify changes list' , () {
211
212
var t = createModel (123 );
212
213
var records = null ;
213
- subs.add (t.changes.listen ((r) { records = r; }));
214
+ subs.add (t.changes.listen ((r) {
215
+ records = r;
216
+ }));
214
217
t.value = 42 ;
215
218
216
219
return new Future (() {
@@ -222,16 +225,22 @@ void _observeTests(createModel(x)) {
222
225
records[0 ] = new PropertyChangeRecord (t, #value, 0 , 1 );
223
226
}, throwsUnsupportedError);
224
227
225
- expect (() { records.clear (); }, throwsUnsupportedError);
228
+ expect (() {
229
+ records.clear ();
230
+ }, throwsUnsupportedError);
226
231
227
- expect (() { records.length = 0 ; }, throwsUnsupportedError);
232
+ expect (() {
233
+ records.length = 0 ;
234
+ }, throwsUnsupportedError);
228
235
});
229
236
});
230
237
231
238
test ('notifyChange' , () {
232
239
var t = createModel (123 );
233
240
var records = [];
234
- subs.add (t.changes.listen ((r) { records.addAll (r); }));
241
+ subs.add (t.changes.listen ((r) {
242
+ records.addAll (r);
243
+ }));
235
244
t.notifyChange (new PropertyChangeRecord (t, #value, 123 , 42 ));
236
245
237
246
return new Future (() {
@@ -243,7 +252,9 @@ void _observeTests(createModel(x)) {
243
252
test ('notifyPropertyChange' , () {
244
253
var t = createModel (123 );
245
254
var records = null ;
246
- subs.add (t.changes.listen ((r) { records = r; }));
255
+ subs.add (t.changes.listen ((r) {
256
+ records = r;
257
+ }));
247
258
expect (t.notifyPropertyChange (#value, t.value, 42 ), 42 ,
248
259
reason: 'notifyPropertyChange returns newValue' );
249
260
@@ -257,10 +268,10 @@ void _observeTests(createModel(x)) {
257
268
expectPropertyChanges (records, int number) {
258
269
expect (records.length, number, reason: 'expected $number change records' );
259
270
for (var record in records) {
260
- expect (record is PropertyChangeRecord , true , reason :
261
- 'record should be PropertyChangeRecord' );
262
- expect ((record as PropertyChangeRecord ).name, #value, reason :
263
- 'record should indicate a change to the "value" property' );
271
+ expect (record is PropertyChangeRecord , true ,
272
+ reason : 'record should be PropertyChangeRecord' );
273
+ expect ((record as PropertyChangeRecord ).name, #value,
274
+ reason : 'record should indicate a change to the "value" property' );
264
275
}
265
276
}
266
277
0 commit comments