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

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

Issue 2097233002: Fix for parsing not closed comment reference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 64f0dbca7083ec183929d79de7a003f59a2c7293..06740395e50809bdfa34f8cf58300f996ffdfb91 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -6302,35 +6302,50 @@ void''');
}
void test_parseCommentReferences_notClosed_noIdentifier() {
- List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
- new DocumentationCommentToken(
- TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)
- ];
- List<CommentReference> references =
- parse("parseCommentReferences", <Object>[tokens], "")
- as List<CommentReference>;
+ DocumentationCommentToken docToken = new DocumentationCommentToken(
+ TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5);
+ List<CommentReference> references = parse(
+ "parseCommentReferences",
+ <Object>[
+ <DocumentationCommentToken>[docToken]
+ ],
+ "") as List<CommentReference>;
+ expect(docToken.references, hasLength(1));
expect(references, hasLength(1));
+ Token referenceToken = docToken.references[0];
CommentReference reference = references[0];
expect(reference, isNotNull);
+ expect(docToken.references[0], same(reference.beginToken));
expect(reference.identifier, isNotNull);
expect(reference.identifier.isSynthetic, isTrue);
expect(reference.identifier.name, "");
+ // Should end with EOF token.
+ Token nextToken = referenceToken.next;
+ expect(nextToken, isNotNull);
+ expect(nextToken.type, TokenType.EOF);
}
void test_parseCommentReferences_notClosed_withIdentifier() {
- List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
- new DocumentationCommentToken(
- TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)
- ];
+ DocumentationCommentToken docToken = new DocumentationCommentToken(
+ TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5);
List<CommentReference> references =
- parse("parseCommentReferences", <Object>[tokens], "")
+ parse("parseCommentReferences", <Object>[<DocumentationCommentToken>[
+ docToken
+ ]], "")
as List<CommentReference>;
+ expect(docToken.references, hasLength(1));
expect(references, hasLength(1));
+ Token referenceToken = docToken.references[0];
CommentReference reference = references[0];
expect(reference, isNotNull);
+ expect(referenceToken, same(reference.beginToken));
expect(reference.identifier, isNotNull);
expect(reference.identifier.isSynthetic, isFalse);
expect(reference.identifier.name, "namePrefix");
+ // Should end with EOF token.
+ Token nextToken = referenceToken.next;
+ expect(nextToken, isNotNull);
+ expect(nextToken.type, TokenType.EOF);
}
void test_parseCommentReferences_singleLine() {
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698