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

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 2707663002: Implement AstBuilder support for library, part, and part-of declarations. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 006350f70ff5690b27d75178f8b6c56bd75f2ce1..9232ff392ea5b7f69aa8aafb6c00ad6b3ab393bf 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -13755,6 +13755,30 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
expect(libraryDirective.semicolon, isNotNull);
}
+ void test_parseDirective_library_1_component() {
+ createParser("library a;");
+ var lib = parseFullDirective() as LibraryDirective;
+ expect(lib.name.components, hasLength(1));
+ expect(lib.name.components[0].name, 'a');
+ }
+
+ void test_parseDirective_library_2_components() {
+ createParser("library a.b;");
+ var lib = parseFullDirective() as LibraryDirective;
+ expect(lib.name.components, hasLength(2));
+ expect(lib.name.components[0].name, 'a');
+ expect(lib.name.components[1].name, 'b');
+ }
+
+ void test_parseDirective_library_3_components() {
+ createParser("library a.b.c;");
+ var lib = parseFullDirective() as LibraryDirective;
+ expect(lib.name.components, hasLength(3));
+ expect(lib.name.components[0].name, 'a');
+ expect(lib.name.components[1].name, 'b');
+ expect(lib.name.components[2].name, 'c');
+ }
+
void test_parseDirective_part() {
createParser("part 'lib/lib.dart';");
Directive directive = parseFullDirective();
@@ -13767,6 +13791,30 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
expect(partDirective.semicolon, isNotNull);
}
+ void test_parseDirective_part_of_1_component() {
+ createParser("part of a;");
+ var partOf = parseFullDirective() as PartOfDirective;
+ expect(partOf.libraryName.components, hasLength(1));
+ expect(partOf.libraryName.components[0].name, 'a');
+ }
+
+ void test_parseDirective_part_of_2_components() {
+ createParser("part of a.b;");
+ var partOf = parseFullDirective() as PartOfDirective;
+ expect(partOf.libraryName.components, hasLength(2));
+ expect(partOf.libraryName.components[0].name, 'a');
+ expect(partOf.libraryName.components[1].name, 'b');
+ }
+
+ void test_parseDirective_part_of_3_components() {
+ createParser("part of a.b.c;");
+ var partOf = parseFullDirective() as PartOfDirective;
+ expect(partOf.libraryName.components, hasLength(3));
+ expect(partOf.libraryName.components[0].name, 'a');
+ expect(partOf.libraryName.components[1].name, 'b');
+ expect(partOf.libraryName.components[2].name, 'c');
+ }
+
void test_parseDirective_partOf() {
createParser("part of l;");
Directive directive = parseFullDirective();

Powered by Google App Engine
This is Rietveld 408576698