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

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: 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
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..ec27c147d68df84badfd62c70361ca1ec132fe8e 100644
--- a/pkg/analyzer/test/generated/scanner_test.dart
+++ b/pkg/analyzer/test/generated/scanner_test.dart
@@ -302,6 +302,18 @@ class ScannerTest {
_assertComment(TokenType.SINGLE_LINE_COMMENT, "// comment");
}
+ 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_generic_method_type_assign() {
+ _assertComment(TokenType.MULTI_LINE_COMMENT, "/*=comment*/");
+ _assertComment(TokenType.GENERIC_METHOD_TYPE_ASSIGN, "/*=comment*/",
+ genericMethodComments: true);
+ }
+
void test_double_both_E() {
_assertToken(TokenType.DOUBLE, "0.123E4");
}
@@ -1048,11 +1060,11 @@ class ScannerTest {
_scanWithListener("'\${(}'", listener);
}
- void _assertComment(TokenType commentType, String source) {
+ void _assertComment(TokenType commentType, String source, {bool genericMethodComments: false}) {
Jennifer Messerly 2015/11/11 18:28:06 Just reran formatter & sort members on this file,
//
// 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 +1076,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 +1245,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.parseGenericMethodComments = true;
+ }
Token result = scanner.tokenize();
listener.setLineInfo(new TestSource(), scanner.lineStarts);
return result;
« pkg/analyzer/test/generated/parser_test.dart ('K') | « 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