OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
5 */ | 5 */ |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "regress_27201_lib.dart" deferred as p; | 8 import "regress_27201_lib.dart" deferred as p; |
9 import "regress_27201_bad_lib_path.dart" deferred as q; | 9 import "regress_27201_bad_lib_path.dart" deferred as q; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } catch (e) { | 29 } catch (e) { |
30 Expect.fail("Should not be here"); | 30 Expect.fail("Should not be here"); |
31 } | 31 } |
32 try { | 32 try { |
33 Expect.isTrue(p.loadLibrary() is Future); | 33 Expect.isTrue(p.loadLibrary() is Future); |
34 } catch (e) { | 34 } catch (e) { |
35 Expect.fail("Should not be here"); | 35 Expect.fail("Should not be here"); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 | |
40 main() { | 39 main() { |
41 p.loadLibrary().then((v) { | 40 p.loadLibrary().then((v) { |
42 test_loaded(); | 41 test_loaded(); |
43 }, | 42 }, onError: (e) { |
44 onError: (e) { | |
45 Expect.fail("Should have loaded library!"); | 43 Expect.fail("Should have loaded library!"); |
46 }); | 44 }); |
47 | 45 |
48 // Ensure bad library import is handled correctly. | 46 // Ensure bad library import is handled correctly. |
49 q.loadLibrary().then((v) { | 47 q.loadLibrary().then((v) { |
50 Expect.fail("Should have failed"); | 48 Expect.fail("Should have failed"); |
51 }, | 49 }, onError: (e) { |
52 onError: (e) { | |
53 Expect.throws(() => q.x); | 50 Expect.throws(() => q.x); |
54 }); | 51 }); |
55 } | 52 } |
56 | |
OLD | NEW |