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

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

Issue 1960503002: Fix all strong-mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: .analysis_options Created 4 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/timeout.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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:matcher/matcher.dart'; 7 import 'package:matcher/matcher.dart';
8 8
9 import '../backend/invoker.dart'; 9 import '../backend/invoker.dart';
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 Invoker.current.addOutstandingCallback(); 51 Invoker.current.addOutstandingCallback();
52 // Queue up an asynchronous expectation that validates when the future 52 // Queue up an asynchronous expectation that validates when the future
53 // completes. 53 // completes.
54 item.then((value) { 54 item.then((value) {
55 fail("Expected future to fail, but succeeded with '$value'."); 55 fail("Expected future to fail, but succeeded with '$value'.");
56 }, onError: (error, trace) { 56 }, onError: (error, trace) {
57 if (_matcher == null) return; 57 if (_matcher == null) return;
58 58
59 var reason; 59 var reason;
60 if (trace != null) { 60 if (trace != null) {
61 var stackTrace = terseChain(trace, 61 var chain = terseChain(trace,
62 verbose: Invoker.current.liveTest.test.metadata.verboseTrace); 62 verbose: Invoker.current.liveTest.test.metadata.verboseTrace);
63 stackTrace = " ${stackTrace.toString().replaceAll("\n", "\n ")}"; 63 reason = "Actual exception trace:\n"
64 reason = "Actual exception trace:\n$stackTrace"; 64 " ${chain.toString().replaceAll("\n", "\n ")}";
65 } 65 }
66 66
67 // Re-run [expect] to get the proper formatting. 67 // Re-run [expect] to get the proper formatting.
68 expect(() => throw error, this, reason: reason); 68 expect(() => throw error, this, reason: reason);
69 }).then((_) => Invoker.current.removeOutstandingCallback()); 69 }).then((_) => Invoker.current.removeOutstandingCallback());
70 // It hasn't failed yet. 70 // It hasn't failed yet.
71 return true; 71 return true;
72 } 72 }
73 73
74 try { 74 try {
(...skipping 27 matching lines...) Expand all
102 mismatchDescription 102 mismatchDescription
103 .add('threw ') 103 .add('threw ')
104 .addDescriptionOf(matchState['exception']); 104 .addDescriptionOf(matchState['exception']);
105 if (verbose) { 105 if (verbose) {
106 mismatchDescription.add(' at ').add(matchState['stack'].toString()); 106 mismatchDescription.add(' at ').add(matchState['stack'].toString());
107 } 107 }
108 return mismatchDescription; 108 return mismatchDescription;
109 } 109 }
110 } 110 }
111 } 111 }
OLDNEW
« no previous file with comments | « lib/src/executable.dart ('k') | lib/src/frontend/timeout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698