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

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 1527393002: Don't produce [references] in GitHub-like code blocks in comments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.generated.parser_test; 5 library analyzer.test.generated.parser_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6771 ]; 6771 ];
6772 List<CommentReference> references = 6772 List<CommentReference> references =
6773 parse("parseCommentReferences", <Object>[tokens], ""); 6773 parse("parseCommentReferences", <Object>[tokens], "");
6774 expect(references, hasLength(1)); 6774 expect(references, hasLength(1));
6775 CommentReference reference = references[0]; 6775 CommentReference reference = references[0];
6776 expect(reference, isNotNull); 6776 expect(reference, isNotNull);
6777 expect(reference.identifier, isNotNull); 6777 expect(reference.identifier, isNotNull);
6778 expect(reference.offset, 24); 6778 expect(reference.offset, 24);
6779 } 6779 }
6780 6780
6781 void test_parseCommentReferences_skipCodeBlock_gitHub() {
6782 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6783 new DocumentationCommentToken(
6784 TokenType.MULTI_LINE_COMMENT, "/** `a[i]` and [b] */", 0)
6785 ];
6786 List<CommentReference> references =
6787 parse("parseCommentReferences", <Object>[tokens], "");
6788 expect(references, hasLength(1));
6789 CommentReference reference = references[0];
6790 expect(reference, isNotNull);
6791 expect(reference.identifier, isNotNull);
6792 expect(reference.offset, 16);
6793 }
6794
6795 void test_parseCommentReferences_skipCodeBlock_gitHub_notTerminated() {
6796 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6797 new DocumentationCommentToken(
6798 TokenType.MULTI_LINE_COMMENT, "/** `a[i] and [b] */", 0)
6799 ];
6800 List<CommentReference> references =
6801 parse("parseCommentReferences", <Object>[tokens], "");
6802 expect(references, hasLength(2));
6803 }
6804
6781 void test_parseCommentReferences_skipCodeBlock_spaces() { 6805 void test_parseCommentReferences_skipCodeBlock_spaces() {
6782 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[ 6806 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6783 new DocumentationCommentToken(TokenType.MULTI_LINE_COMMENT, 6807 new DocumentationCommentToken(TokenType.MULTI_LINE_COMMENT,
6784 "/**\n * a[i]\n * xxx [i] zzz\n */", 3) 6808 "/**\n * a[i]\n * xxx [i] zzz\n */", 3)
6785 ]; 6809 ];
6786 List<CommentReference> references = 6810 List<CommentReference> references =
6787 parse("parseCommentReferences", <Object>[tokens], ""); 6811 parse("parseCommentReferences", <Object>[tokens], "");
6788 expect(references, hasLength(1)); 6812 expect(references, hasLength(1));
6789 CommentReference reference = references[0]; 6813 CommentReference reference = references[0];
6790 expect(reference, isNotNull); 6814 expect(reference, isNotNull);
(...skipping 4517 matching lines...) Expand 10 before | Expand all | Expand 10 after
11308 new Scanner(null, new CharSequenceReader(source), listener); 11332 new Scanner(null, new CharSequenceReader(source), listener);
11309 Token tokenStream = scanner.tokenize(); 11333 Token tokenStream = scanner.tokenize();
11310 // 11334 //
11311 // Parse the source. 11335 // Parse the source.
11312 // 11336 //
11313 Parser parser = new Parser(null, listener); 11337 Parser parser = new Parser(null, listener);
11314 return invokeParserMethodImpl( 11338 return invokeParserMethodImpl(
11315 parser, methodName, <Object>[tokenStream], tokenStream) as Token; 11339 parser, methodName, <Object>[tokenStream], tokenStream) as Token;
11316 } 11340 }
11317 } 11341 }
OLDNEW
« no previous file with comments | « 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