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_shown; | 5 library test.library_imports_shown; |
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_shown.dart'; | 11 import 'library_imports_shown.dart'; |
12 | 12 |
13 test(MirrorSystem mirrors) { | 13 test(MirrorSystem mirrors) { |
14 LibraryMirror shown = mirrors.findLibrary(#library_imports_shown); | 14 LibraryMirror shown = mirrors.findLibrary(#library_imports_shown); |
15 LibraryMirror a = mirrors.findLibrary(#library_imports_a); | 15 LibraryMirror a = mirrors.findLibrary(#library_imports_a); |
16 LibraryMirror b = mirrors.findLibrary(#library_imports_b); | 16 LibraryMirror b = mirrors.findLibrary(#library_imports_b); |
17 LibraryMirror core = mirrors.findLibrary(#dart.core); | 17 LibraryMirror core = mirrors.findLibrary(#dart.core); |
18 | 18 |
19 Expect.setEquals([a, b, core], | 19 Expect.setEquals( |
20 shown.libraryDependencies.map((dep) => dep.targetLibrary)); | 20 [a, b, core], shown.libraryDependencies.map((dep) => dep.targetLibrary)); |
21 | 21 |
22 Expect.stringEquals( | 22 Expect.stringEquals( |
23 'import dart.core\n' | 23 'import dart.core\n' |
24 'import library_imports_a\n' | 24 'import library_imports_a\n' |
25 ' show somethingFromA\n' | 25 ' show somethingFromA\n' |
26 ' show somethingFromBoth\n' | 26 ' show somethingFromBoth\n' |
27 'import library_imports_b\n' | 27 'import library_imports_b\n' |
28 ' show somethingFromB\n', | 28 ' show somethingFromB\n', |
29 stringifyDependencies(shown)); | 29 stringifyDependencies(shown)); |
30 } | 30 } |
31 | 31 |
32 main() { | 32 main() { |
33 test(currentMirrorSystem()); | 33 test(currentMirrorSystem()); |
34 } | 34 } |
OLD | NEW |