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

Side by Side Diff: pkg/analyzer/test/src/summary/summarize_ast_test.dart

Issue 2669863003: Handle invalid URIs in summaries. (Closed)
Patch Set: Remove uri.dart, tweak for summarize_ast_test. Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.src.summary.summarize_ast_test; 5 library analyzer.test.src.summary.summarize_ast_test;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/error/listener.dart'; 10 import 'package:analyzer/error/listener.dart';
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 linkerInputs = createLinkerInputs(text); 146 linkerInputs = createLinkerInputs(text);
147 linked = link( 147 linked = link(
148 linkerInputs.linkedLibraries, 148 linkerInputs.linkedLibraries,
149 linkerInputs.getDependency, 149 linkerInputs.getDependency,
150 linkerInputs.getUnit, 150 linkerInputs.getUnit,
151 (name) => null, 151 (name) => null,
152 strongMode)[linkerInputs.testDartUri.toString()]; 152 strongMode)[linkerInputs.testDartUri.toString()];
153 expect(linked, isNotNull); 153 expect(linked, isNotNull);
154 validateLinkedLibrary(linked); 154 validateLinkedLibrary(linked);
155 unlinkedUnits = <UnlinkedUnit>[linkerInputs.unlinkedDefiningUnit]; 155 unlinkedUnits = <UnlinkedUnit>[linkerInputs.unlinkedDefiningUnit];
156 for (String relativeUri 156 for (String relativeUriStr
157 in linkerInputs.unlinkedDefiningUnit.publicNamespace.parts) { 157 in linkerInputs.unlinkedDefiningUnit.publicNamespace.parts) {
158 Uri relativeUri;
159 try {
160 relativeUri = Uri.parse(relativeUriStr);
161 } on FormatException {
162 unlinkedUnits.add(new UnlinkedUnitBuilder());
163 continue;
164 }
165
158 UnlinkedUnit unit = uriToUnit[ 166 UnlinkedUnit unit = uriToUnit[
159 resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri)) 167 resolveRelativeUri(linkerInputs.testDartUri, relativeUri).toString()];
160 .toString()];
161 if (unit == null) { 168 if (unit == null) {
162 if (!allowMissingFiles) { 169 if (!allowMissingFiles) {
163 fail('Test referred to unknown unit $relativeUri'); 170 fail('Test referred to unknown unit $relativeUriStr');
164 } 171 }
165 } else { 172 } else {
166 unlinkedUnits.add(unit); 173 unlinkedUnits.add(unit);
167 } 174 }
168 } 175 }
169 } 176 }
170 177
171 test_class_no_superclass() { 178 test_class_no_superclass() {
172 UnlinkedClass cls = serializeClassText('part of dart.core; class Object {}', 179 UnlinkedClass cls = serializeClassText('part of dart.core; class Object {}',
173 className: 'Object'); 180 className: 'Object');
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 * passed to [addNamedSource]. 343 * passed to [addNamedSource].
337 */ 344 */
338 Map<String, UnlinkedUnitBuilder> uriToUnit = <String, UnlinkedUnitBuilder>{}; 345 Map<String, UnlinkedUnitBuilder> uriToUnit = <String, UnlinkedUnitBuilder>{};
339 346
340 /** 347 /**
341 * Information about summaries to be included in the link process. 348 * Information about summaries to be included in the link process.
342 */ 349 */
343 SummaryDataStore summaryDataStore = 350 SummaryDataStore summaryDataStore =
344 new SummaryDataStore([], recordDependencyInfo: true); 351 new SummaryDataStore([], recordDependencyInfo: true);
345 } 352 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_common.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698