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

Side by Side Diff: test/dependency_graph_test.dart

Issue 1406983003: Remove the checker and corresponding dead code (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « test/codegen_test.dart ('k') | test/end_to_end_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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 dev_compiler.test.dependency_graph_test; 5 library dev_compiler.test.dependency_graph_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 '/a10.dart': 'library a10;', 58 '/a10.dart': 'library a10;',
59 }; 59 };
60 60
61 nodeOf(String filepath) => graph.nodeFromUri(new Uri.file(filepath)); 61 nodeOf(String filepath) => graph.nodeFromUri(new Uri.file(filepath));
62 62
63 setUp(() { 63 setUp(() {
64 /// We completely reset the TestUriResolver to avoid interference between 64 /// We completely reset the TestUriResolver to avoid interference between
65 /// tests (since some tests modify the state of the files). 65 /// tests (since some tests modify the state of the files).
66 testResourceProvider = createTestResourceProvider(testFiles); 66 testResourceProvider = createTestResourceProvider(testFiles);
67 testUriResolver = new ResourceUriResolver(testResourceProvider); 67 testUriResolver = new ResourceUriResolver(testResourceProvider);
68 context = createAnalysisContextWithSources( 68 context = createAnalysisContextWithSources(options.sourceOptions,
69 options.strongOptions, options.sourceOptions,
70 fileResolvers: [testUriResolver]); 69 fileResolvers: [testUriResolver]);
71 graph = new SourceGraph(context, new LogReporter(context), options); 70 graph = new SourceGraph(context, new LogReporter(context), options);
72 }); 71 });
73 72
74 updateFile(Source source, [String newContents]) { 73 updateFile(Source source, [String newContents]) {
75 var path = testResourceProvider.pathContext.fromUri(source.uri); 74 var path = testResourceProvider.pathContext.fromUri(source.uri);
76 if (newContents == null) newContents = source.contents.data; 75 if (newContents == null) newContents = source.contents.data;
77 testResourceProvider.updateFile(path, newContents); 76 testResourceProvider.updateFile(path, newContents);
78 } 77 }
79 78
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 '''); 677 ''');
679 }); 678 });
680 }); 679 });
681 680
682 group('server-mode', () { 681 group('server-mode', () {
683 setUp(() { 682 setUp(() {
684 var opts = new CompilerOptions( 683 var opts = new CompilerOptions(
685 runtimeDir: '/dev_compiler_runtime/', 684 runtimeDir: '/dev_compiler_runtime/',
686 sourceOptions: new SourceResolverOptions(useMockSdk: true), 685 sourceOptions: new SourceResolverOptions(useMockSdk: true),
687 serverMode: true); 686 serverMode: true);
688 context = createAnalysisContextWithSources( 687 context = createAnalysisContextWithSources(opts.sourceOptions,
689 opts.strongOptions, opts.sourceOptions,
690 fileResolvers: [testUriResolver]); 688 fileResolvers: [testUriResolver]);
691 graph = new SourceGraph(context, new LogReporter(context), opts); 689 graph = new SourceGraph(context, new LogReporter(context), opts);
692 }); 690 });
693 691
694 test('messages widget is automatically included', () { 692 test('messages widget is automatically included', () {
695 var node = nodeOf('/index3.html'); 693 var node = nodeOf('/index3.html');
696 expectGraph( 694 expectGraph(
697 node, 695 node,
698 ''' 696 '''
699 index3.html 697 index3.html
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 var source = nodeOf('/bar.dart').source; 1156 var source = nodeOf('/bar.dart').source;
1159 updateFile(source, "hi"); 1157 updateFile(source, "hi");
1160 results = []; 1158 results = [];
1161 rebuild(node, buildWithTransitiveChange); 1159 rebuild(node, buildWithTransitiveChange);
1162 expect(results, ['bar.dart', 'foo.dart']); 1160 expect(results, ['bar.dart', 'foo.dart']);
1163 }); 1161 });
1164 }); 1162 });
1165 1163
1166 group('null for non-existing files', () { 1164 group('null for non-existing files', () {
1167 setUp(() { 1165 setUp(() {
1168 context = createAnalysisContextWithSources( 1166 context = createAnalysisContextWithSources(options.sourceOptions,
1169 options.strongOptions, options.sourceOptions,
1170 fileResolvers: [testUriResolver]); 1167 fileResolvers: [testUriResolver]);
1171 graph = new SourceGraph(context, new LogReporter(context), options); 1168 graph = new SourceGraph(context, new LogReporter(context), options);
1172 }); 1169 });
1173 1170
1174 test('recognize locally change between existing and not-existing', () { 1171 test('recognize locally change between existing and not-existing', () {
1175 var n = nodeOf('/foo.dart'); 1172 var n = nodeOf('/foo.dart');
1176 expect(n.source.exists(), isFalse); 1173 expect(n.source.exists(), isFalse);
1177 var source = 1174 var source =
1178 testResourceProvider.newFile('/foo.dart', 'hi').createSource(); 1175 testResourceProvider.newFile('/foo.dart', 'hi').createSource();
1179 expect( 1176 expect(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 helper(node); 1240 helper(node);
1244 return sb.toString(); 1241 return sb.toString();
1245 } 1242 }
1246 1243
1247 final runtimeFilesWithoutPath = defaultRuntimeFiles 1244 final runtimeFilesWithoutPath = defaultRuntimeFiles
1248 .map((f) => f.replaceAll('dart/', '')) 1245 .map((f) => f.replaceAll('dart/', ''))
1249 .toList(growable: false); 1246 .toList(growable: false);
1250 final _RUNTIME_GRAPH = runtimeFilesWithoutPath.map((s) => '|-- $s').join('\n'); 1247 final _RUNTIME_GRAPH = runtimeFilesWithoutPath.map((s) => '|-- $s').join('\n');
1251 final _RUNTIME_GRAPH_REBUILD = 1248 final _RUNTIME_GRAPH_REBUILD =
1252 runtimeFilesWithoutPath.map((s) => '|-- $s [needs-rebuild]').join('\n'); 1249 runtimeFilesWithoutPath.map((s) => '|-- $s [needs-rebuild]').join('\n');
OLDNEW
« no previous file with comments | « test/codegen_test.dart ('k') | test/end_to_end_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698