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

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

Issue 2662363002: The file is a library, if it has a 'library' directive. (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 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 expect(_excludeSdk(file.importedFiles), isEmpty); 267 expect(_excludeSdk(file.importedFiles), isEmpty);
268 expect(file.exportedFiles, isEmpty); 268 expect(file.exportedFiles, isEmpty);
269 expect(file.partedFiles, isEmpty); 269 expect(file.partedFiles, isEmpty);
270 expect(_excludeSdk(file.directReferencedFiles), isEmpty); 270 expect(_excludeSdk(file.directReferencedFiles), isEmpty);
271 expect(file.isPart, isFalse); 271 expect(file.isPart, isFalse);
272 expect(file.library, isNull); 272 expect(file.library, isNull);
273 expect(file.unlinked, isNotNull); 273 expect(file.unlinked, isNotNull);
274 expect(file.unlinked.classes, isEmpty); 274 expect(file.unlinked.classes, isEmpty);
275 } 275 }
276 276
277 test_getFileForPath_hasLibraryDirective_hasPartOfDirective() {
278 String a = _p('/test/lib/a.dart');
279 provider.newFile(
280 a,
281 r'''
282 library L;
283 part of L;
284 ''');
285 FileState file = fileSystemState.getFileForPath(a);
286 expect(file.isPart, isFalse);
287 }
288
277 test_getFileForPath_library() { 289 test_getFileForPath_library() {
278 String a1 = _p('/aaa/lib/a1.dart'); 290 String a1 = _p('/aaa/lib/a1.dart');
279 String a2 = _p('/aaa/lib/a2.dart'); 291 String a2 = _p('/aaa/lib/a2.dart');
280 String a3 = _p('/aaa/lib/a3.dart'); 292 String a3 = _p('/aaa/lib/a3.dart');
281 String a4 = _p('/aaa/lib/a4.dart'); 293 String a4 = _p('/aaa/lib/a4.dart');
282 String b1 = _p('/bbb/lib/b1.dart'); 294 String b1 = _p('/bbb/lib/b1.dart');
283 String b2 = _p('/bbb/lib/b2.dart'); 295 String b2 = _p('/bbb/lib/b2.dart');
284 String content_a1 = r''' 296 String content_a1 = r'''
285 import 'package:aaa/a2.dart'; 297 import 'package:aaa/a2.dart';
286 import 'package:bbb/b1.dart'; 298 import 'package:bbb/b1.dart';
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 String _p(String path) => provider.convertPath(path); 731 String _p(String path) => provider.convertPath(path);
720 732
721 static String _md5(String content) { 733 static String _md5(String content) {
722 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 734 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
723 } 735 }
724 } 736 }
725 737
726 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {} 738 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {}
727 739
728 class _SourceMock extends TypedMock implements Source {} 740 class _SourceMock extends TypedMock implements Source {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698