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

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

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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
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 substitute_future_test; 5 library substitute_future_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:scheduled_test/src/substitute_future.dart'; 9 import 'package:scheduled_test/src/substitute_future.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 13 matching lines...) Expand all
24 completer.complete('success'); 24 completer.complete('success');
25 }); 25 });
26 26
27 test('.asStream on error', () { 27 test('.asStream on error', () {
28 expect(future.asStream().toList(), throwsA(equals('error'))); 28 expect(future.asStream().toList(), throwsA(equals('error')));
29 completer.completeError('error'); 29 completer.completeError('error');
30 }); 30 });
31 31
32 test('.then and .catchError on success', () { 32 test('.then and .catchError on success', () {
33 expect(future.then((v) => "transformed $v") 33 expect(future.then((v) => "transformed $v")
34 .catchError((e) => "caught ${e.error}"), 34 .catchError((error) => "caught ${error}"),
35 completion(equals('transformed success'))); 35 completion(equals('transformed success')));
36 completer.complete('success'); 36 completer.complete('success');
37 }); 37 });
38 38
39 test('.then and .catchError on error', () { 39 test('.then and .catchError on error', () {
40 expect(future.then((v) => "transformed $v") 40 expect(future.then((v) => "transformed $v")
41 .catchError((e) => "caught ${e.error}"), 41 .catchError((error) => "caught ${error}"),
42 completion(equals('caught error'))); 42 completion(equals('caught error')));
43 completer.completeError('error'); 43 completer.completeError('error');
44 }); 44 });
45 45
46 test('.then with onError on success', () { 46 test('.then with onError on success', () {
47 expect(future.then((v) => "transformed $v", 47 expect(future.then((v) => "transformed $v",
48 onError: (e) => "caught ${e.error}"), 48 onError: (error) => "caught ${error}"),
49 completion(equals('transformed success'))); 49 completion(equals('transformed success')));
50 completer.complete('success'); 50 completer.complete('success');
51 }); 51 });
52 52
53 test('.then with onError on error', () { 53 test('.then with onError on error', () {
54 expect(future.then((v) => "transformed $v", 54 expect(future.then((v) => "transformed $v",
55 onError: (e) => "caught ${e.error}"), 55 onError: (error) => "caught ${error}"),
56 completion(equals('caught error'))); 56 completion(equals('caught error')));
57 completer.completeError('error'); 57 completer.completeError('error');
58 }); 58 });
59 59
60 test('.whenComplete on success', () { 60 test('.whenComplete on success', () {
61 expect(future.whenComplete(() { 61 expect(future.whenComplete(() {
62 throw 'whenComplete'; 62 throw 'whenComplete';
63 }), throwsA(equals('whenComplete'))); 63 }), throwsA(equals('whenComplete')));
64 completer.complete('success'); 64 completer.complete('success');
65 }); 65 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 }); 145 });
146 146
147 test('substituting after a future has completed is an error', () { 147 test('substituting after a future has completed is an error', () {
148 var completer = new Completer(); 148 var completer = new Completer();
149 var future = new SubstituteFuture(completer.future); 149 var future = new SubstituteFuture(completer.future);
150 completer.complete('success'); 150 completer.complete('success');
151 expect(() => future.substitute(new Future.immediate(null)), 151 expect(() => future.substitute(new Future.immediate(null)),
152 throwsStateError); 152 throwsStateError);
153 }); 153 });
154 } 154 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/scheduled_test/wrap_future_test.dart ('k') | pkg/scheduled_test/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698