Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: tests/lib/mirrors/library_imports_deferred_test.dart

Issue 921163004: Add LibraryDependencyMirror.isDeferred. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync + year fix Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/stringify.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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_deferred;
6
7 import 'dart:mirrors';
8 import 'package:expect/expect.dart';
9 import 'stringify.dart';
10
11 import 'dart:collection' as eagercollection;
12 import 'dart:collection' deferred as lazycollection;
13
14 test(MirrorSystem mirrors) {
15 LibraryMirror thisLibrary =
16 mirrors.findLibrary(#test.library_imports_deferred);
17 LibraryMirror collection =
18 mirrors.findLibrary(#dart.collection);
19
20 var importsOfCollection = thisLibrary.libraryDependencies.where(
21 (dep) => dep.targetLibrary == collection).toList();
22 Expect.equals(2, importsOfCollection.length);
23 Expect.notEquals(importsOfCollection[0].isDeferred,
24 importsOfCollection[1].isDeferred); // One deferred, one not .
25
26 // Only collection is defer-imported.
27 LibraryDependencyMirror dep =
28 thisLibrary.libraryDependencies.singleWhere((dep) => dep.isDeferred);
29 Expect.equals(collection, dep.targetLibrary);
30
31 Expect.stringEquals(
32 'import dart.collection as eagercollection\n'
33 'import dart.collection deferred as lazycollection\n'
34 ' hide loadLibrary\n'
35 'import dart.core\n'
36 'import dart.mirrors\n'
37 'import expect\n'
38 'import test.stringify\n',
39 stringifyDependencies(thisLibrary));
40 }
41
42 main() {
43 test(currentMirrorSystem());
44 }
OLDNEW
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/stringify.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698