| 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 import "package:expect/expect.dart"; | |
| 6 | |
| 7 isCheckedMode() { | 5 isCheckedMode() { |
| 8 try { | 6 try { |
| 9 var i = 1; | 7 var i = 1; |
| 10 String s = i; | 8 String s = i; |
| 11 return false; | 9 return false; |
| 12 } catch (e) { | 10 } catch (e) { |
| 13 return true; | 11 return true; |
| 14 } | 12 } |
| 15 } | 13 } |
| 16 | 14 |
| 17 int returnString1() => 's'; | 15 int returnString1() => 's'; |
| 18 void returnNull() => null; | 16 void returnNull() => null; |
| 19 void returnString2() => 's'; | 17 void returnString2() => 's'; |
| 20 | 18 |
| 21 main() { | 19 main() { |
| 22 if (isCheckedMode()) { | 20 if (isCheckedMode()) { |
| 23 Expect.throws(returnString1, (e) => e is TypeError); | 21 Expect.throws(returnString1, (e) => e is TypeError); |
| 24 Expect.throws(returnString2, (e) => e is TypeError); | 22 Expect.throws(returnString2, (e) => e is TypeError); |
| 25 returnNull(); | 23 returnNull(); |
| 26 } else { | 24 } else { |
| 27 returnString1(); | 25 returnString1(); |
| 28 returnNull(); | 26 returnNull(); |
| 29 returnString2(); | 27 returnString2(); |
| 30 } | 28 } |
| 31 } | 29 } |
| OLD | NEW |