OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
6 | 6 |
7 import 'package:metatest/metatest.dart'; | |
8 import '../utils.dart'; | 7 import '../utils.dart'; |
9 | 8 |
10 void main() { | 9 void main() { |
11 setUpMockClock(); | 10 setUpMockClock(); |
12 | 11 |
13 expectTestPasses("out-of-band schedule() runs its function immediately (but " | 12 expectTestPasses("out-of-band schedule() runs its function immediately (but " |
14 "asynchronously)", () { | 13 "asynchronously)", () { |
15 mockClock.run(); | 14 mockClock.run(); |
16 schedule(() { | 15 schedule(() { |
17 expect(sleep(1).then((_) { | 16 expect(sleep(1).then((_) { |
(...skipping 14 matching lines...) Expand all Loading... |
32 var scheduleRun = false; | 31 var scheduleRun = false; |
33 expect(sleep(1).then((_) { | 32 expect(sleep(1).then((_) { |
34 schedule(() => sleep(1).then((_) { | 33 schedule(() => sleep(1).then((_) { |
35 scheduleRun = true; | 34 scheduleRun = true; |
36 })); | 35 })); |
37 }), completes); | 36 }), completes); |
38 | 37 |
39 currentSchedule.onComplete.schedule(() => expect(scheduleRun, isTrue)); | 38 currentSchedule.onComplete.schedule(() => expect(scheduleRun, isTrue)); |
40 }); | 39 }); |
41 } | 40 } |
OLD | NEW |