Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: pkg/scheduled_test/test/scheduled_test/current_schedule_errors_test.dart

Issue 227193002: pkg/scheduled_test: handle null currentSchedule due to timeout (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/scheduled_test/test/metatest.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:async';
6
5 import 'package:scheduled_test/scheduled_test.dart'; 7 import 'package:scheduled_test/scheduled_test.dart';
6 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock; 8 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
7 9
8 import '../metatest.dart'; 10 import '../metatest.dart';
9 import '../utils.dart'; 11 import '../utils.dart';
10 12
11 void main(_, message) { 13 void main(_, message) {
12 initMetatest(message); 14 initMetatest(message);
13 15
14 setUpTimeout(); 16 setUpTimeout();
15 17
18 expectTests('a scheduled test with an out-of-band error should fail', () {
19 test('test 1', () {
20 sleep(5).then((_) => throw 'error');
nweiz 2014/04/10 00:58:15 If you're going to use [sleep] like this, you need
21 });
22
23 test('test 2', () {
24 return sleep(10);
25 });
26 }, {'test 1': ERROR, 'test 2': PASS});
27
16 expectTestsPass('currentSchedule.errors contains the error in the onComplete ' 28 expectTestsPass('currentSchedule.errors contains the error in the onComplete '
17 'queue', () { 29 'queue', () {
18 var errors; 30 var errors;
19 test('test 1', () { 31 test('test 1', () {
20 currentSchedule.onComplete.schedule(() { 32 currentSchedule.onComplete.schedule(() {
21 errors = currentSchedule.errors; 33 errors = currentSchedule.errors;
22 }); 34 });
23 35
24 throw 'error'; 36 throw 'error';
25 }); 37 });
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 throw 'in-band'; 241 throw 'in-band';
230 })); 242 }));
231 }); 243 });
232 244
233 test('test 2', () { 245 test('test 2', () {
234 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 246 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
235 expect(errors.map((e) => e.error), equals(['in-band', 'out-of-band'])); 247 expect(errors.map((e) => e.error), equals(['in-band', 'out-of-band']));
236 }); 248 });
237 }, passing: ['test 2']); 249 }, passing: ['test 2']);
238 } 250 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/metatest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698