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

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

Issue 2526063002: Add parser support for using a URI in a part-of directive (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8964de9faa3282dbaecbded66151d45491b8098d..6ce609fc7fa4c46f32b9503f453d05735baeccca 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -2853,6 +2853,12 @@ class ParserTestCase extends EngineTestCase {
bool enableNnbd = false;
/**
+ * A flag indicating whether the parser is to parse part-of directives that
+ * specify a URI rather than a library name.
+ */
+ bool enableUriInPartOf = false;
+
+ /**
* The error listener to which scanner and parser errors will be reported.
*
* This field is typically initialized by invoking [createParser].
@@ -2902,6 +2908,7 @@ class ParserTestCase extends EngineTestCase {
parser.parseGenericMethodComments = enableGenericMethodComments;
parser.parseFunctionBodies = parseFunctionBodies;
parser.enableNnbd = enableNnbd;
+ parser.enableUriInPartOf = enableUriInPartOf;
parser.currentToken = tokenStream;
}
@@ -11087,7 +11094,7 @@ void''');
// TODO(brianwilkerson) Implement tests for this method.
}
- void test_parsePartDirective_part() {
+ void test_parsePartDirective() {
createParser("part 'lib/lib.dart';");
PartDirective directive =
parser.parsePartOrPartOfDirective(emptyCommentAndMetadata());
@@ -11098,15 +11105,27 @@ void''');
expect(directive.semicolon, isNotNull);
}
- void test_parsePartDirective_partOf() {
- createParser('part of l;');
+ void test_parsePartOfDirective_name() {
+ enableUriInPartOf = true;
+ createParser("part of l;");
PartOfDirective directive =
parser.parsePartOrPartOfDirective(emptyCommentAndMetadata());
- expectNotNullIfNoErrors(directive);
- listener.assertNoErrors();
expect(directive.partKeyword, isNotNull);
expect(directive.ofKeyword, isNotNull);
expect(directive.libraryName, isNotNull);
+ expect(directive.uri, isNull);
+ expect(directive.semicolon, isNotNull);
+ }
+
+ void test_parsePartOfDirective_uri() {
+ enableUriInPartOf = true;
+ createParser("part of 'lib.dart';");
+ PartOfDirective directive =
+ parser.parsePartOrPartOfDirective(emptyCommentAndMetadata());
+ expect(directive.partKeyword, isNotNull);
+ expect(directive.ofKeyword, isNotNull);
+ expect(directive.libraryName, isNull);
+ expect(directive.uri, isNotNull);
expect(directive.semicolon, isNotNull);
}
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698