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

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

Issue 1167733004: Decide if unit without directives is a part or a library. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 0e236efe4cd3f75de13cf4bf196683828bc07b58..9b3a0b7f7d7f63de8a450e12b850bd7aa931c458 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -2137,6 +2137,22 @@ class B {}''');
expect(outputs[UNITS], hasLength(1));
}
+ test_perform_computeSourceKind_noDirectives_noContainingLibraries() {
+ _performParseTask('');
+ expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
+ }
+
+ test_perform_computeSourceKind_noDirectives_hasContainingLibraries() {
+ // Parse "lib.dart" to let the context know that "test.dart" is a part.
+ _computeResult(newSource('/lib.dart', r'''
+library lib;
+part 'test.dart';
+'''), PARSED_UNIT);
+ // So, know "test.dat" is parsed as a part.
+ _performParseTask('');
+ expect(outputs[SOURCE_KIND], SourceKind.PART);
+ }
+
test_perform_doesNotExist() {
_performParseTask(null);
expect(outputs, hasLength(8));

Powered by Google App Engine
This is Rietveld 408576698