OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016, 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 main() { | |
25 foo().then( | |
26 (_) { | |
27 Expect.isFalse(isCheckedMode()); | |
28 }, | |
29 onError: (e) { | |
30 Expect.isTrue(isCheckedMode() && (e is TypeError)); | |
31 } | |
32 ); | |
33 } | |
34 | |
OLD | NEW |