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