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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/file_state_test.dart

Issue 2520593003: Use AnalysisDriverUnlinkedUnit as a container for UnlinkedUnit and referenced names. (Closed)
Patch Set: Created 4 years, 1 month 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 import 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 7
8 import 'package:analyzer/file_system/file_system.dart'; 8 import 'package:analyzer/file_system/file_system.dart';
9 import 'package:analyzer/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/source/package_map_resolver.dart'; 10 import 'package:analyzer/source/package_map_resolver.dart';
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 expect(filePackageUri.uri, packageUri); 204 expect(filePackageUri.uri, packageUri);
205 205
206 expect(fileFileUri.path, path); 206 expect(fileFileUri.path, path);
207 expect(fileFileUri.uri, fileUri); 207 expect(fileFileUri.uri, fileUri);
208 208
209 // The file with the `package:` style URI is canonical, and is the first. 209 // The file with the `package:` style URI is canonical, and is the first.
210 var files = fileSystemState.getFilesForPath(path); 210 var files = fileSystemState.getFilesForPath(path);
211 expect(files, [filePackageUri, fileFileUri]); 211 expect(files, [filePackageUri, fileFileUri]);
212 } 212 }
213 213
214 test_referencedNames() {
215 String path = _p('/aaa/lib/a.dart');
216 provider.newFile(
217 path,
218 r'''
219 A foo(B p) {
220 foo(null);
221 C c = new C(p);
222 return c;
223 }
224 ''');
225 FileState file = fileSystemState.getFileForPath(path);
226 expect(file.referencedNames, unorderedEquals(['A', 'B', 'C']));
227 }
228
214 test_refresh_differentApiSignature() { 229 test_refresh_differentApiSignature() {
215 String path = _p('/aaa/lib/a.dart'); 230 String path = _p('/aaa/lib/a.dart');
216 provider.newFile( 231 provider.newFile(
217 path, 232 path,
218 r''' 233 r'''
219 class A {} 234 class A {}
220 '''); 235 ''');
221 FileState file = fileSystemState.getFileForPath(path); 236 FileState file = fileSystemState.getFileForPath(path);
222 expect(file.unlinked.classes[0].name, 'A'); 237 expect(file.unlinked.classes[0].name, 'A');
223 List<int> signature = file.apiSignature; 238 List<int> signature = file.apiSignature;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 void _assertTransitiveFiles(FileState file, List<FileState> expected) { 366 void _assertTransitiveFiles(FileState file, List<FileState> expected) {
352 expect(file.transitiveFiles, unorderedEquals(expected)); 367 expect(file.transitiveFiles, unorderedEquals(expected));
353 } 368 }
354 369
355 String _p(String path) => provider.convertPath(path); 370 String _p(String path) => provider.convertPath(path);
356 371
357 static String _md5(String content) { 372 static String _md5(String content) {
358 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 373 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
359 } 374 }
360 } 375 }
OLDNEW
« pkg/analyzer/lib/src/dart/analysis/file_state.dart ('K') | « pkg/analyzer/lib/src/summary/idl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698