| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This library contains an Expect class with static methods that can be used | 6 * This library contains an Expect class with static methods that can be used |
| 7 * for simple unit-tests. | 7 * for simple unit-tests. |
| 8 */ | 8 */ |
| 9 library expect; | 9 library expect; |
| 10 | 10 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 const TrustTypeAnnotations(); | 496 const TrustTypeAnnotations(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 /// Annotation class for testing of dart2js. Use this as metadata on method | 499 /// Annotation class for testing of dart2js. Use this as metadata on method |
| 500 /// declarations to disable closed world assumptions on parameters, effectively | 500 /// declarations to disable closed world assumptions on parameters, effectively |
| 501 /// assuming that the runtime arguments could be any value. Note that the | 501 /// assuming that the runtime arguments could be any value. Note that the |
| 502 /// constraints due to [TrustTypeAnnotations] still apply. | 502 /// constraints due to [TrustTypeAnnotations] still apply. |
| 503 class AssumeDynamic { | 503 class AssumeDynamic { |
| 504 const AssumeDynamic(); | 504 const AssumeDynamic(); |
| 505 } | 505 } |
| 506 |
| 507 /// Is true iff type assertions are enabled. |
| 508 final bool typeAssertionsEnabled = (() { |
| 509 try { |
| 510 var i = 42; |
| 511 String s = i; |
| 512 } on TypeError catch (e) { |
| 513 return true; |
| 514 } |
| 515 return false; |
| 516 })(); |
| 517 |
| 518 /// Is true iff `assert` statements are enabled. |
| 519 final bool assertStatementsEnabled = (() { |
| 520 try { |
| 521 assert(false); |
| 522 } on AssertionError catch (e) { |
| 523 return true; |
| 524 } |
| 525 return false; |
| 526 })(); |
| 527 |
| 528 /// Is true iff checked mode is enabled. |
| 529 final bool checkedModeEnabled = |
| 530 typeAssertionsEnabled && assertStatementsEnabled; |
| OLD | NEW |