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

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

Issue 229633002: Fix an analyzer warning in scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/lib/scheduled_test.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 library test_utils; 5 library test_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 import 'package:scheduled_test/src/utils.dart'; 10 import 'package:scheduled_test/src/utils.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // bots, but the Linux and Mac bots have started taking upwards of 5s when 55 // bots, but the Linux and Mac bots have started taking upwards of 5s when
56 // running pumpEventQueue, so we're increasing the timeout across the board 56 // running pumpEventQueue, so we're increasing the timeout across the board
57 // (see issue 9248). 57 // (see issue 9248).
58 currentSchedule.timeout = new Duration(seconds: 10); 58 currentSchedule.timeout = new Duration(seconds: 10);
59 }); 59 });
60 } 60 }
61 61
62 /// Creates a metatest with [body] and asserts that it passes. 62 /// Creates a metatest with [body] and asserts that it passes.
63 /// 63 ///
64 /// This is like [expectTestsPass], but the [test] is set up automatically. 64 /// This is like [expectTestsPass], but the [test] is set up automatically.
65 void expectTestPasses(String description, void body()) => 65 void expectTestPasses(String description, Future body()) =>
66 expectTestsPass(description, () => test('test', body)); 66 expectTestsPass(description, () => test('test', body));
67 67
68 /// Creates a metatest that runs [testBody], captures its schedule errors, and 68 /// Creates a metatest that runs [testBody], captures its schedule errors, and
69 /// passes them to [validator]. 69 /// passes them to [validator].
70 /// 70 ///
71 /// [testBody] is expected to produce an error, while [validator] is expected to 71 /// [testBody] is expected to produce an error, while [validator] is expected to
72 /// produce none. 72 /// produce none.
73 void expectTestFails(String description, void testBody(), 73 void expectTestFails(String description, Future testBody(),
74 void validator(List<ScheduleError> errors)) { 74 void validator(List<ScheduleError> errors)) {
75 expectTestsPass(description, () { 75 expectTestsPass(description, () {
76 var errors; 76 var errors;
77 test('test body', () { 77 test('test body', () {
78 currentSchedule.onException.schedule(() { 78 currentSchedule.onException.schedule(() {
79 errors = currentSchedule.errors; 79 errors = currentSchedule.errors;
80 }); 80 });
81 81
82 testBody(); 82 testBody();
83 }); 83 });
84 84
85 test('validate errors', () { 85 test('validate errors', () {
86 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 86 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
87 validator(errors); 87 validator(errors);
88 }); 88 });
89 }, passing: ['validate errors']); 89 }, passing: ['validate errors']);
90 } 90 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698