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

Side by Side Diff: test/utils.dart

Issue 916533003: Add an Invoker class that manages a running test. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Code review changes Created 5 years, 10 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
« no previous file with comments | « test/invoker_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
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 library unittest.test.utils;
6
7 import 'dart:async';
8
9 import 'package:unittest/unittest.dart';
10
11 /// Returns a matcher that matches a [TestFailure] with the given [message].
12 Matcher isTestFailure(String message) => predicate(
13 (error) => error is TestFailure && error.message == message,
14 'is a TestFailure with message "$message"');
15
16 /// Returns a [Future] that completes after pumping the event queue [times]
17 /// times.
18 ///
19 /// By default, this should pump the event queue enough times to allow any code
20 /// to run, as long as it's not waiting on some external event.
21 Future pumpEventQueue([int times=20]) {
22 if (times == 0) return new Future.value();
23 // Use [new Future] future to allow microtask events to finish. The [new
24 // Future.value] constructor uses scheduleMicrotask itself and would therefore
25 // not wait for microtask callbacks that are scheduled after invoking this
26 // method.
27 return new Future(() => pumpEventQueue(times - 1));
28 }
OLDNEW
« no previous file with comments | « test/invoker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698