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

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

Issue 812253002: Delete a bunch of packages that are now on GitHub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-delete http Created 6 years 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6
7 import 'package:metatest/metatest.dart';
8 import 'utils.dart';
9
10 void main() => initTests(_test);
11
12 void _test(message) {
13 initMetatest(message);
14
15 setUpTimeout();
16
17 expectTestsPass("expect(..., completes) with a completing future should pass",
18 () {
19 test('test', () {
20 expect(pumpEventQueue(), completes);
21 });
22 });
23
24 expectTestsPass("expect(..., completes) with a failing future should signal "
25 "an out-of-band error", () {
26 var errors;
27 test('test 1', () {
28 currentSchedule.onException.schedule(() {
29 errors = currentSchedule.errors;
30 });
31
32 expect(pumpEventQueue().then((_) {
33 throw 'error';
34 }), completes);
35 });
36
37 test('test 2', () {
38 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
39 expect(errors.map((e) => e.error), equals(['error']));
40 });
41 }, passing: ['test 2']);
42
43 expectTestsPass("expect(..., completion(...)) with a matching future should "
44 "pass", () {
45 test('test', () {
46 expect(pumpEventQueue().then((_) => 'foo'), completion(equals('foo')));
47 });
48 });
49
50 expectTestsPass("expect(..., completion(...)) with a non-matching future "
51 "should signal an out-of-band error", () {
52 var errors;
53 test('test 1', () {
54 currentSchedule.onException.schedule(() {
55 errors = currentSchedule.errors;
56 });
57
58 expect(pumpEventQueue().then((_) => 'foo'), completion(equals('bar')));
59 });
60
61 test('test 2', () {
62 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
63 expect(errors.length, equals(1));
64 expect(errors.first.error, new isInstanceOf<TestFailure>());
65 });
66 }, passing: ['test 2']);
67
68 expectTestsPass("expect(..., completion(...)) with a failing future should "
69 "signal an out-of-band error", () {
70 var errors;
71 test('test 1', () {
72 currentSchedule.onException.schedule(() {
73 errors = currentSchedule.errors;
74 });
75
76 expect(pumpEventQueue().then((_) {
77 throw 'error';
78 }), completion(equals('bar')));
79 });
80
81 test('test 2', () {
82 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
83 expect(errors.map((e) => e.error), equals(['error']));
84 });
85 }, passing: ['test 2']);
86 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/descriptor/utils.dart ('k') | pkg/scheduled_test/test/scheduled_process_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698