OLD | NEW |
(Empty) | |
| 1 /* |
| 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 |
| 4 * BSD-style license that can be found in the LICENSE file. |
| 5 */ |
| 6 import "dart:async"; |
| 7 import "package:expect/expect.dart"; |
| 8 import "regress_27201_lib.dart" deferred as p; |
| 9 import "regress_27201_bad_lib_path.dart" deferred as q; |
| 10 |
| 11 test_loaded() { |
| 12 try { |
| 13 p.someFunc(); |
| 14 } catch (e) { |
| 15 Expect.fail("Should not be here"); |
| 16 } |
| 17 try { |
| 18 p.someGetter; |
| 19 } catch (e) { |
| 20 Expect.fail("Should not be here"); |
| 21 } |
| 22 try { |
| 23 p.someSetter = 1; |
| 24 } catch (e) { |
| 25 Expect.fail("Should not be here"); |
| 26 } |
| 27 try { |
| 28 p.Func; |
| 29 } catch (e) { |
| 30 Expect.fail("Should not be here"); |
| 31 } |
| 32 try { |
| 33 Expect.isTrue(p.loadLibrary() is Future); |
| 34 } catch (e) { |
| 35 Expect.fail("Should not be here"); |
| 36 } |
| 37 } |
| 38 |
| 39 |
| 40 main() { |
| 41 p.loadLibrary().then((v) { |
| 42 test_loaded(); |
| 43 }, |
| 44 onError: (e) { |
| 45 Expect.fail("Should have loaded library!"); |
| 46 }); |
| 47 |
| 48 // Ensure bad library import is handled correctly. |
| 49 q.loadLibrary().then((v) { |
| 50 Expect.fail("Should have failed"); |
| 51 }, |
| 52 onError: (e) { |
| 53 Expect.throws(() => q.x); |
| 54 }); |
| 55 } |
| 56 |
OLD | NEW |