| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 506 |
| 507 /// Is true iff type assertions are enabled. | 507 /// Is true iff type assertions are enabled. |
| 508 final bool typeAssertionsEnabled = (() { | 508 final bool typeAssertionsEnabled = (() { |
| 509 try { | 509 try { |
| 510 var i = 42; | 510 dynamic i = 42; |
| 511 String s = i; | 511 String s = i; |
| 512 } on TypeError catch (e) { | 512 } on TypeError catch (e) { |
| 513 return true; | 513 return true; |
| 514 } | 514 } |
| 515 return false; | 515 return false; |
| 516 })(); | 516 })(); |
| 517 | 517 |
| 518 /// Is true iff `assert` statements are enabled. | 518 /// Is true iff `assert` statements are enabled. |
| 519 final bool assertStatementsEnabled = (() { | 519 final bool assertStatementsEnabled = (() { |
| 520 try { | 520 try { |
| 521 assert(false); | 521 assert(false); |
| 522 } on AssertionError catch (e) { | 522 } on AssertionError catch (e) { |
| 523 return true; | 523 return true; |
| 524 } | 524 } |
| 525 return false; | 525 return false; |
| 526 })(); | 526 })(); |
| 527 | 527 |
| 528 /// Is true iff checked mode is enabled. | 528 /// Is true iff checked mode is enabled. |
| 529 final bool checkedModeEnabled = | 529 final bool checkedModeEnabled = |
| 530 typeAssertionsEnabled && assertStatementsEnabled; | 530 typeAssertionsEnabled && assertStatementsEnabled; |
| OLD | NEW |