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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 main() { | 7 main() { |
8 var assertsEnabled = false; | 8 var assertsEnabled = false; |
9 assert((assertsEnabled = true)); | 9 assert((assertsEnabled = true)); |
10 if (!assertsEnabled) return; | 10 if (!assertsEnabled) return; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 var toString = new ToString(); | 79 var toString = new ToString(); |
80 try { | 80 try { |
81 assert(false, toString); | 81 assert(false, toString); |
82 Expect.fail("Assert should throw."); | 82 Expect.fail("Assert should throw."); |
83 } catch (e) { | 83 } catch (e) { |
84 Expect.isFalse(toString.calledToString); | 84 Expect.isFalse(toString.calledToString); |
85 Expect.isTrue(e.toString().contains("Instance of 'ToString'")); | 85 Expect.isTrue(e.toString().contains("Instance of 'ToString'")); |
86 Expect.isFalse(toString.calledToString); | 86 Expect.isFalse(toString.calledToString); |
87 } | 87 } |
88 } | 88 } |
OLD | NEW |