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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1160873004: Only units with 'part of' and no other directives are parts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index ac1be9fb0a5ac20f63be44feef43ee5ca7a39dda..bd3ad5c753f35afd915d558f4555b568f48a0e55 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -2171,18 +2171,18 @@ class B {}''');
expect(outputs[UNITS], hasLength(1));
}
- test_perform_computeSourceKind_noDirectives_hasContainingLibraries() {
- // Parse "lib.dart" to let the context know that "test.dart" is a part.
+ test_perform_computeSourceKind_noDirectives_hasContainingLibrary() {
+ // Parse "lib.dart" to let the context know that "test.dart" is included.
_computeResult(newSource('/lib.dart', r'''
library lib;
part 'test.dart';
'''), PARSED_UNIT);
- // So, know "test.dat" is parsed as a part.
+ // If there are no the "part of" directive, then it is not a part.
_performParseTask('');
- expect(outputs[SOURCE_KIND], SourceKind.PART);
+ expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
}
- test_perform_computeSourceKind_noDirectives_noContainingLibraries() {
+ test_perform_computeSourceKind_noDirectives_noContainingLibrary() {
_performParseTask('');
expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
}
@@ -2237,6 +2237,21 @@ class A {''');
expect(outputs[UNITS], hasLength(2));
}
+ test_perform_part() {
+ _performParseTask(r'''
+part of lib;
+class B {}''');
+ expect(outputs, hasLength(8));
+ expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0));
+ expect(outputs[EXPORTED_LIBRARIES], hasLength(0));
+ _assertHasCore(outputs[IMPORTED_LIBRARIES], 1);
+ expect(outputs[INCLUDED_PARTS], hasLength(0));
+ expect(outputs[PARSE_ERRORS], hasLength(0));
+ expect(outputs[PARSED_UNIT], isNotNull);
+ expect(outputs[SOURCE_KIND], SourceKind.PART);
+ expect(outputs[UNITS], hasLength(1));
+ }
+
void _performParseTask(String content) {
AnalysisTarget target = newSource('/test.dart', content);
_computeResult(target, PARSED_UNIT);

Powered by Google App Engine
This is Rietveld 408576698