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

Side by Side Diff: pkg/scheduled_test/lib/src/scheduled_future_matchers.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 scheduled_future_matchers; 5 library scheduled_future_matchers;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 var matcherDescription = new StringDescription(); 59 var matcherDescription = new StringDescription();
60 _matcher.describe(matcherDescription); 60 _matcher.describe(matcherDescription);
61 description = 'expect(..., completion($matcherDescription))'; 61 description = 'expect(..., completion($matcherDescription))';
62 } 62 }
63 } 63 }
64 64
65 var outerTrace = new Trace.current(); 65 var outerTrace = new Trace.current();
66 currentSchedule.wrapFuture(item.then((value) { 66 currentSchedule.wrapFuture(item.then((value) {
67 if (_matcher == null) return; 67 if (_matcher == null) return;
68 68
69 try { 69 // TODO(floitsch): we cannot switch traces anymore.
70 expect(value, _matcher); 70 // If expect throws we might want to be able to switch to the outer trace
71 } catch (e, stackTrace) { 71 // instead.
72 throw new AsyncError(e, outerTrace); 72 expect(value, _matcher);
73 }
74 }), description); 73 }), description);
75 74
76 return true; 75 return true;
77 } 76 }
78 77
79 Description describe(Description description) { 78 Description describe(Description description) {
80 if (_matcher == null) { 79 if (_matcher == null) {
81 description.add('completes successfully'); 80 description.add('completes successfully');
82 } else { 81 } else {
83 description.add('completes to a value that ').addDescriptionOf(_matcher); 82 description.add('completes to a value that ').addDescriptionOf(_matcher);
84 } 83 }
85 return description; 84 return description;
86 } 85 }
87 } 86 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule_error.dart ('k') | pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698