| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; |
| 7 |
| 8 isCheckedMode() { |
| 9 try { |
| 10 var i = 1; |
| 11 String s = i; |
| 12 return false; |
| 13 } on TypeError { |
| 14 return true; |
| 15 } |
| 16 } |
| 17 |
| 18 var x = 'a'; |
| 19 |
| 20 Future<int> foo() async { |
| 21 return x; |
| 22 } |
| 23 |
| 24 Future<int> bar() async => x; |
| 25 |
| 26 main() { |
| 27 foo().then((_) { |
| 28 Expect.isFalse(isCheckedMode()); |
| 29 }, onError: (e) { |
| 30 Expect.isTrue(isCheckedMode() && (e is TypeError)); |
| 31 }); |
| 32 bar().then((_) { |
| 33 Expect.isFalse(isCheckedMode()); |
| 34 }, onError: (e) { |
| 35 Expect.isTrue(isCheckedMode() && (e is TypeError)); |
| 36 }); |
| 37 } |
| OLD | NEW |