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

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

Issue 2302003003: [linter] Issue 295. Skip comment tokens with GitHub code blocks (in ```). (Closed)
Patch Set: Created 4 years, 3 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 cf9f082a7f08962b6ab2895b6e2f2c28b9c5d551..596fb0e1cd48599a05e78fe4189777bdbfb9b334 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -6534,6 +6534,46 @@ void''');
expect(reference.offset, 16);
}
+ void test_parseCommentReferences_skipCodeBlock_gitHub_multiLine() {
+ List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
+ new DocumentationCommentToken(
+ TokenType.MULTI_LINE_COMMENT,
+ r'''
+/**
+ * First.
+ * ```dart
+ * Some [int] reference.
+ * ```
+ * Last.
+ */
+''',
+ 3)
+ ];
+ List<CommentReference> references =
+ parse("parseCommentReferences", <Object>[tokens], "")
+ as List<CommentReference>;
+ expect(references, isEmpty);
+ }
+
+ void test_parseCommentReferences_skipCodeBlock_gitHub_multiLine_lines() {
+ String commentText = r'''
+/// First.
+/// ```dart
+/// Some [int] reference.
+/// ```
+/// Last.
+''';
+ List<DocumentationCommentToken> tokens = commentText
+ .split('\n')
+ .map((line) => new DocumentationCommentToken(
+ TokenType.SINGLE_LINE_COMMENT, line, 0))
+ .toList();
+ List<CommentReference> references =
+ parse("parseCommentReferences", <Object>[tokens], "")
+ as List<CommentReference>;
+ expect(references, isEmpty);
+ }
+
void test_parseCommentReferences_skipCodeBlock_gitHub_notTerminated() {
List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
new DocumentationCommentToken(
« pkg/analyzer/lib/src/generated/parser.dart ('K') | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698