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

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

Issue 1434863003: initial generic method comment parsing (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: re-sort members Created 5 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/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/scanner_test.dart
diff --git a/pkg/analyzer/test/generated/scanner_test.dart b/pkg/analyzer/test/generated/scanner_test.dart
index 119d4aa1202328f23994342815051eb0d1ccf971..a0c73558c6307b58c8188699fb59371ab104e72f 100644
--- a/pkg/analyzer/test/generated/scanner_test.dart
+++ b/pkg/analyzer/test/generated/scanner_test.dart
@@ -264,6 +264,18 @@ class ScannerTest {
expect(token.precedingComments, isNull);
}
+ void test_comment_generic_method_type_assign() {
+ _assertComment(TokenType.MULTI_LINE_COMMENT, "/*=comment*/");
+ _assertComment(TokenType.GENERIC_METHOD_TYPE_ASSIGN, "/*=comment*/",
+ genericMethodComments: true);
+ }
+
+ void test_comment_generic_method_type_list() {
+ _assertComment(TokenType.MULTI_LINE_COMMENT, "/*<comment>*/");
+ _assertComment(TokenType.GENERIC_METHOD_TYPE_LIST, "/*<comment>*/",
+ genericMethodComments: true);
+ }
+
void test_comment_multi() {
_assertComment(TokenType.MULTI_LINE_COMMENT, "/* comment */");
}
@@ -1048,11 +1060,12 @@ class ScannerTest {
_scanWithListener("'\${(}'", listener);
}
- void _assertComment(TokenType commentType, String source) {
+ void _assertComment(TokenType commentType, String source,
+ {bool genericMethodComments: false}) {
//
// Test without a trailing end-of-line marker
//
- Token token = _scan(source);
+ Token token = _scan(source, genericMethodComments: genericMethodComments);
expect(token, isNotNull);
expect(token.type, TokenType.EOF);
Token comment = token.precedingComments;
@@ -1064,7 +1077,7 @@ class ScannerTest {
//
// Test with a trailing end-of-line marker
//
- token = _scan("$source\n");
+ token = _scan("$source\n", genericMethodComments: genericMethodComments);
expect(token, isNotNull);
expect(token.type, TokenType.EOF);
comment = token.precedingComments;
@@ -1233,16 +1246,21 @@ class ScannerTest {
expect(token.type, TokenType.EOF);
}
- Token _scan(String source) {
+ Token _scan(String source, {bool genericMethodComments: false}) {
GatheringErrorListener listener = new GatheringErrorListener();
- Token token = _scanWithListener(source, listener);
+ Token token = _scanWithListener(source, listener,
+ genericMethodComments: genericMethodComments);
listener.assertNoErrors();
return token;
}
- Token _scanWithListener(String source, GatheringErrorListener listener) {
+ Token _scanWithListener(String source, GatheringErrorListener listener,
+ {bool genericMethodComments: false}) {
Scanner scanner =
new Scanner(null, new CharSequenceReader(source), listener);
+ if (genericMethodComments) {
+ scanner.scanGenericMethodComments = true;
+ }
Token result = scanner.tokenize();
listener.setLineInfo(new TestSource(), scanner.lineStarts);
return result;
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698