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

Side by Side Diff: lib/src/frontend/future_matchers.dart

Issue 1124113002: Add a flag controlling how verbose stack traces are. (Closed) Base URL: git@github.com:dart-lang/test.git@master
Patch Set: Created 5 years, 7 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 | « lib/src/executable.dart ('k') | lib/src/frontend/throws_matcher.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 test.frontend.future_matchers; 5 library test.frontend.future_matchers;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:matcher/matcher.dart' hide throws, throwsA, expect, fail; 9 import 'package:matcher/matcher.dart' hide throws, throwsA, expect, fail;
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }, onError: (error, trace) { 53 }, onError: (error, trace) {
54 if (error is TestFailure) { 54 if (error is TestFailure) {
55 Invoker.current.handleError(error, trace); 55 Invoker.current.handleError(error, trace);
56 return; 56 return;
57 } 57 }
58 58
59 var id = _id == '' ? '' : '${_id} '; 59 var id = _id == '' ? '' : '${_id} ';
60 var reason = 'Expected future ${id}to complete successfully, ' 60 var reason = 'Expected future ${id}to complete successfully, '
61 'but it failed with ${error}'; 61 'but it failed with ${error}';
62 if (trace != null) { 62 if (trace != null) {
63 var stackTrace = terseChain(trace).toString(); 63 var stackTrace = terseChain(trace,
64 stackTrace = ' ${stackTrace.replaceAll('\n', '\n ')}'; 64 verbose: Invoker.current.metadata.verboseTrace);
65 stackTrace = ' ${stackTrace.toString().replaceAll('\n', '\n ')}';
65 reason = '$reason\nStack trace:\n$stackTrace'; 66 reason = '$reason\nStack trace:\n$stackTrace';
66 } 67 }
67 fail(reason); 68 fail(reason);
68 }); 69 });
69 70
70 return true; 71 return true;
71 } 72 }
72 73
73 Description describe(Description description) { 74 Description describe(Description description) {
74 if (_matcher == null) { 75 if (_matcher == null) {
75 description.add('completes successfully'); 76 description.add('completes successfully');
76 } else { 77 } else {
77 description.add('completes to a value that ').addDescriptionOf(_matcher); 78 description.add('completes to a value that ').addDescriptionOf(_matcher);
78 } 79 }
79 return description; 80 return description;
80 } 81 }
81 } 82 }
OLDNEW
« no previous file with comments | « lib/src/executable.dart ('k') | lib/src/frontend/throws_matcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698