OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, 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 library test.library_imports; | |
6 | |
7 import 'dart:mirrors'; | |
8 import 'package:expect/expect.dart'; | |
9 import 'stringify.dart'; | |
10 | |
11 import 'library_imports_metadata.dart'; | |
12 | |
13 main() { | |
14 LibraryMirror lib = currentMirrorSystem().findLibrary(#library_imports_metadat
a); | |
15 | |
16 LibraryMirror core = currentMirrorSystem().findLibrary(#dart.core); | |
17 LibraryMirror mirrors = currentMirrorSystem().findLibrary(#dart.mirrors); | |
18 LibraryMirror collection = currentMirrorSystem().findLibrary(#dart.collection)
; | |
19 LibraryMirror async = currentMirrorSystem().findLibrary(#dart.async); | |
20 | |
21 Expect.setEquals([core, mirrors, collection, async], | |
22 lib.libraryDependencies.map((dep) => dep.targetLibrary)); | |
23 | |
24 Expect.stringEquals( | |
25 'import dart.async\n' | |
26 'import dart.collection\n' | |
27 'import dart.core\n' | |
28 'import dart.mirrors as mirrors\n', | |
29 stringifyDependencies(lib)); | |
30 | |
31 Expect.listEquals( | |
32 [].map(reflect).toList(), | |
33 lib.libraryDependencies | |
34 .singleWhere((dep) => dep.targetLibrary == core).metadata); | |
35 | |
36 Expect.listEquals( | |
37 [m1].map(reflect).toList(), | |
38 lib.libraryDependencies | |
39 .singleWhere((dep) => dep.targetLibrary == mirrors).metadata); | |
40 | |
41 Expect.listEquals( | |
42 [m2, m3].map(reflect).toList(), | |
43 lib.libraryDependencies | |
44 .singleWhere((dep) => dep.targetLibrary == collection).metadata); | |
45 | |
46 Expect.listEquals( | |
47 [].map(reflect).toList(), | |
48 lib.libraryDependencies | |
49 .singleWhere((dep) => dep.targetLibrary == async).metadata); | |
50 } | |
OLD | NEW |