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

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

Issue 1379203002: Refactor groups to pipe them through to the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 2 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/backend/test.dart ('k') | lib/src/runner.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.throws_matcher; 5 library test.frontend.throws_matcher;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:matcher/matcher.dart'; 9 import 'package:matcher/matcher.dart';
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Queue up an asynchronous expectation that validates when the future 54 // Queue up an asynchronous expectation that validates when the future
55 // completes. 55 // completes.
56 item.then((value) { 56 item.then((value) {
57 fail("Expected future to fail, but succeeded with '$value'."); 57 fail("Expected future to fail, but succeeded with '$value'.");
58 }, onError: (error, trace) { 58 }, onError: (error, trace) {
59 if (_matcher == null) return; 59 if (_matcher == null) return;
60 60
61 var reason; 61 var reason;
62 if (trace != null) { 62 if (trace != null) {
63 var stackTrace = terseChain(trace, 63 var stackTrace = terseChain(trace,
64 verbose: Invoker.current.metadata.verboseTrace); 64 verbose: Invoker.current.liveTest.test.metadata.verboseTrace);
65 stackTrace = " ${stackTrace.toString().replaceAll("\n", "\n ")}"; 65 stackTrace = " ${stackTrace.toString().replaceAll("\n", "\n ")}";
66 reason = "Actual exception trace:\n$stackTrace"; 66 reason = "Actual exception trace:\n$stackTrace";
67 } 67 }
68 68
69 // Re-run [expect] to get the proper formatting. 69 // Re-run [expect] to get the proper formatting.
70 expect(() => throw error, this, reason: reason); 70 expect(() => throw error, this, reason: reason);
71 }).then((_) => Invoker.current.removeOutstandingCallback()); 71 }).then((_) => Invoker.current.removeOutstandingCallback());
72 // It hasn't failed yet. 72 // It hasn't failed yet.
73 return true; 73 return true;
74 } 74 }
(...skipping 29 matching lines...) Expand all
104 mismatchDescription 104 mismatchDescription
105 .add('threw ') 105 .add('threw ')
106 .addDescriptionOf(matchState['exception']); 106 .addDescriptionOf(matchState['exception']);
107 if (verbose) { 107 if (verbose) {
108 mismatchDescription.add(' at ').add(matchState['stack'].toString()); 108 mismatchDescription.add(' at ').add(matchState['stack'].toString());
109 } 109 }
110 return mismatchDescription; 110 return mismatchDescription;
111 } 111 }
112 } 112 }
113 } 113 }
OLDNEW
« no previous file with comments | « lib/src/backend/test.dart ('k') | lib/src/runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698