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

Unified Diff: test/chain/chain_test.dart

Issue 1583483003: Add a "when" parameter to Chain.capture(). (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/chain/chain_test.dart
diff --git a/test/chain/chain_test.dart b/test/chain/chain_test.dart
index cddb4a623acb86e86911365714e403895d3cd9f4..40b06d55224fcd8d6811e471d257b09db4bd9963 100644
--- a/test/chain/chain_test.dart
+++ b/test/chain/chain_test.dart
@@ -36,6 +36,22 @@ void main() {
});
});
+ group("Chain.capture() with when: false", () {
+ test("with no onError doesn't block errors", () {
+ expect(Chain.capture(() => new Future.error("oh no"), when: false),
+ throwsA("oh no"));
+ });
+
+ test("with onError blocks errors", () {
+ Chain.capture(() {
+ return new Future.error("oh no");
+ }, onError: expectAsync((error, chain) {
+ expect(error, equals("oh no"));
+ expect(chain, new isInstanceOf<Chain>());
+ }), when: false);
+ });
+ });
+
test("toString() ensures that all traces are aligned", () {
var chain = new Chain([
new Trace.parse('short 10:11 Foo.bar\n'),
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698