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

Side by Side Diff: tests/language/assert_message_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // SharedOptions=--assert-message 5 // SharedOptions=--assert-message
6 6
7 import "dart:async"; 7 import "dart:async";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Failing asserts evaluate message after test. 60 // Failing asserts evaluate message after test.
61 var list = []; 61 var list = [];
62 try { 62 try {
63 assert((list..add(1)).isEmpty, (list..add(3)).length); 63 assert((list..add(1)).isEmpty, (list..add(3)).length);
64 } on AssertionError catch (e) { 64 } on AssertionError catch (e) {
65 Expect.equals(2, e.message); 65 Expect.equals(2, e.message);
66 Expect.listEquals([1, 3], list); 66 Expect.listEquals([1, 3], list);
67 } 67 }
68 68
69 asyncStart(); 69 asyncStart();
70 asyncTests().then((_) { asyncEnd(); }); 70 asyncTests().then((_) {
71 asyncEnd();
72 });
71 } 73 }
72 74
73
74 Future asyncTests() async { 75 Future asyncTests() async {
75 // You can await in both condition and message. 76 // You can await in both condition and message.
76 assert(true, await 0); 77 assert(true, await 0);
77 assert(await true, 1); 78 assert(await true, 1);
78 assert(await true, await 2); 79 assert(await true, await 2);
79 80
80 // Successful asserts won't await/evaluate message. 81 // Successful asserts won't await/evaluate message.
81 void unreachable() => throw "unreachable"; 82 void unreachable() => throw "unreachable";
82 assert(await true, await unreachable()); 83 assert(await true, await unreachable());
83 84
(...skipping 11 matching lines...) Expand all
95 } on AssertionError catch (e) { 96 } on AssertionError catch (e) {
96 Expect.equals(4, e.message); 97 Expect.equals(4, e.message);
97 } 98 }
98 99
99 try { 100 try {
100 assert(await falseFuture, await new Future.error("error")); 101 assert(await falseFuture, await new Future.error("error"));
101 } on String catch (e) { 102 } on String catch (e) {
102 Expect.equals("error", e); 103 Expect.equals("error", e);
103 } 104 }
104 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698