OLD | NEW |
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 | |
6 | |
7 import "dart:async"; | 5 import "dart:async"; |
8 | 6 |
9 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
10 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
11 | 9 |
| 10 // TODO(rnystrom): Unify with assert_with_message_test.dart. |
| 11 |
12 main() { | 12 main() { |
13 // Only run with asserts enabled mode. | 13 // Only run with asserts enabled mode. |
14 bool assertsEnabled = false; | 14 bool assertsEnabled = false; |
15 assert(assertsEnabled = true); | 15 assert(assertsEnabled = true); |
16 if (!assertsEnabled) return; | 16 if (!assertsEnabled) return; |
17 | 17 |
18 // Basics. | 18 // Basics. |
19 assert(true, ""); | 19 assert(true, ""); |
20 assert(() => true, ""); | 20 assert(() => true, ""); |
21 | 21 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } on AssertionError catch (e) { | 96 } on AssertionError catch (e) { |
97 Expect.equals(4, e.message); | 97 Expect.equals(4, e.message); |
98 } | 98 } |
99 | 99 |
100 try { | 100 try { |
101 assert(await falseFuture, await new Future.error("error")); | 101 assert(await falseFuture, await new Future.error("error")); |
102 } on String catch (e) { | 102 } on String catch (e) { |
103 Expect.equals("error", e); | 103 Expect.equals("error", e); |
104 } | 104 } |
105 } | 105 } |
OLD | NEW |