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