OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library checked_mode_helper; | 5 library checked_mode_helper; |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 | 8 |
9 /// Returns `true` if the program is running in checked mode. | 9 /// Returns `true` if the program is running in checked mode. |
10 bool inCheckedMode() { | 10 bool inCheckedMode() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 /// of execution mode. | 45 /// of execution mode. |
46 void checkNoDynamicTypeError(f(), [String message]) { | 46 void checkNoDynamicTypeError(f(), [String message]) { |
47 message = message != null ? ': $message' : ''; | 47 message = message != null ? ': $message' : ''; |
48 try { | 48 try { |
49 f(); | 49 f(); |
50 } on TypeError catch (e) { | 50 } on TypeError catch (e) { |
51 String mode = inCheckedMode() ? 'checked mode' : 'production mode'; | 51 String mode = inCheckedMode() ? 'checked mode' : 'production mode'; |
52 Expect.fail('Unexpected type error in $mode$message.'); | 52 Expect.fail('Unexpected type error in $mode$message.'); |
53 } | 53 } |
54 } | 54 } |
OLD | NEW |