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

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

Issue 2669863003: Handle invalid URIs in summaries. (Closed)
Patch Set: 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 UnlinkedUnit unit = uriToUnit[ 158 UnlinkedUnit unit;
159 resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri)) 159 try {
160 .toString()]; 160 Uri relativeUri = Uri.parse(relativeUriStr);
161 if (unit == null) { 161 unit = uriToUnit[
162 if (!allowMissingFiles) { 162 resolveRelativeUri(linkerInputs.testDartUri, relativeUri)
163 fail('Test referred to unknown unit $relativeUri'); 163 .toString()];
164 if (unit == null) {
165 if (!allowMissingFiles) {
166 fail('Test referred to unknown unit $relativeUriStr');
167 }
168 } else {
169 unlinkedUnits.add(unit);
164 } 170 }
165 } else { 171 } on FormatException {}
Brian Wilkerson 2017/02/01 21:02:10 Comment explaining why we don't care about the exc
scheglov 2017/02/01 21:08:48 I made a tweak - we now store an empty unlinked un
166 unlinkedUnits.add(unit);
167 }
168 } 172 }
169 } 173 }
170 174
171 test_class_no_superclass() { 175 test_class_no_superclass() {
172 UnlinkedClass cls = serializeClassText('part of dart.core; class Object {}', 176 UnlinkedClass cls = serializeClassText('part of dart.core; class Object {}',
173 className: 'Object'); 177 className: 'Object');
174 expect(cls.supertype, isNull); 178 expect(cls.supertype, isNull);
175 expect(cls.hasNoSupertype, isTrue); 179 expect(cls.hasNoSupertype, isTrue);
176 } 180 }
177 } 181 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 * passed to [addNamedSource]. 340 * passed to [addNamedSource].
337 */ 341 */
338 Map<String, UnlinkedUnitBuilder> uriToUnit = <String, UnlinkedUnitBuilder>{}; 342 Map<String, UnlinkedUnitBuilder> uriToUnit = <String, UnlinkedUnitBuilder>{};
339 343
340 /** 344 /**
341 * Information about summaries to be included in the link process. 345 * Information about summaries to be included in the link process.
342 */ 346 */
343 SummaryDataStore summaryDataStore = 347 SummaryDataStore summaryDataStore =
344 new SummaryDataStore([], recordDependencyInfo: true); 348 new SummaryDataStore([], recordDependencyInfo: true);
345 } 349 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698