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

Side by Side Diff: pkg/scheduled_test/lib/src/scheduled_future_matchers.dart

Issue 93143002: Make pkg/stack_trace use stack chains. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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';
10
11 import '../scheduled_test.dart'; 9 import '../scheduled_test.dart';
12 10
13 /// Matches a [Future] that completes successfully with a value. Note that this 11 /// Matches a [Future] that completes successfully with a value. Note that this
14 /// creates an asynchronous expectation. The call to `expect()` that includes 12 /// creates an asynchronous expectation. The call to `expect()` that includes
15 /// this will return immediately and execution will continue. Later, when the 13 /// this will return immediately and execution will continue. Later, when the
16 /// future completes, the actual expectation will run. 14 /// future completes, the actual expectation will run.
17 /// 15 ///
18 /// To test that a Future completes with an exception, you can use [throws] and 16 /// To test that a Future completes with an exception, you can use [throws] and
19 /// [throwsA]. 17 /// [throwsA].
20 /// 18 ///
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (description == null) { 53 if (description == null) {
56 if (_matcher == null) { 54 if (_matcher == null) {
57 description = 'expect(..., completes)'; 55 description = 'expect(..., completes)';
58 } else { 56 } else {
59 var matcherDescription = new StringDescription(); 57 var matcherDescription = new StringDescription();
60 _matcher.describe(matcherDescription); 58 _matcher.describe(matcherDescription);
61 description = 'expect(..., completion($matcherDescription))'; 59 description = 'expect(..., completion($matcherDescription))';
62 } 60 }
63 } 61 }
64 62
65 var outerTrace = new Trace.current();
66 currentSchedule.wrapFuture(item.then((value) { 63 currentSchedule.wrapFuture(item.then((value) {
67 if (_matcher == null) return; 64 if (_matcher == null) return;
68 65
69 // TODO(floitsch): we cannot switch traces anymore.
70 // If expect throws we might want to be able to switch to the outer trace 66 // If expect throws we might want to be able to switch to the outer trace
71 // instead. 67 // instead.
72 expect(value, _matcher); 68 expect(value, _matcher);
73 }), description); 69 }), description);
74 70
75 return true; 71 return true;
76 } 72 }
77 73
78 Description describe(Description description) { 74 Description describe(Description description) {
79 if (_matcher == null) { 75 if (_matcher == null) {
80 description.add('completes successfully'); 76 description.add('completes successfully');
81 } else { 77 } else {
82 description.add('completes to a value that ').addDescriptionOf(_matcher); 78 description.add('completes to a value that ').addDescriptionOf(_matcher);
83 } 79 }
84 return description; 80 return description;
85 } 81 }
86 } 82 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule_error.dart ('k') | pkg/scheduled_test/lib/src/scheduled_server/handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698