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

Side by Side Diff: third_party/pkg/di/test/generator_test.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « third_party/pkg/di/test/fixed-unittest.dart ('k') | third_party/pkg/di/test/main.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 import 'dart:io';
2 import 'package:analyzer/analyzer.dart';
3 import 'package:di/generator.dart' as generator;
4 import 'package:unittest/unittest.dart';
5
6 main(args) => group('generator', () {
7
8 test('should codesplit deferred libraries', () {
9 Map<generator.Chunk, String> code = generator.generateCode(
10 'test/assets/gen_test1/main.dart', ['annotations.Injectable'],
11 Platform.environment['DART_SDK'], [Platform.packageRoot]);
12
13 expect(code.keys.map((chunk) => chunk.library == null ? null : chunk.library .name),
14 unorderedEquals([null, 'lib_a', 'lib_b']));
15
16 code.forEach((chunk, code) {
17 var cu = parseCompilationUnit(code);
18 if (chunk.library == null) {
19 expectHasImports(cu, ['main.dart', 'common1.dart']);
20 } else if (chunk.library.name.endsWith('lib_a')) {
21 expectHasImports(cu, ['a.dart', 'a2.dart', 'common2.dart']);
22 } else if (chunk.library.name.endsWith('lib_b')) {
23 expectHasImports(cu, ['b.dart', 'b2.dart', 'common2.dart']);
24 }
25 });
26 });
27 });
28
29 expectHasImports(CompilationUnit cu, List<String> expectedImports) {
30 var imports = <String>[];
31 cu.directives.forEach((Directive directive) {
32 if (directive is NamespaceDirective) {
33 if (directive is! ImportDirective) {
34 fail('Only expecting import, no exports.');
35 }
36 ImportDirective import = directive;
37 imports.add(import.uri.stringValue);
38 }
39 });
40 expect(imports.length, equals(expectedImports.length));
41 for (int i = 0; i < imports.length; i++) {
42 expect(imports[i], endsWith(expectedImports[i]));
43 }
44 }
OLDNEW
« no previous file with comments | « third_party/pkg/di/test/fixed-unittest.dart ('k') | third_party/pkg/di/test/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698