| Index: pkg/front_end/test/token_test.dart
|
| diff --git a/pkg/front_end/test/token_test.dart b/pkg/front_end/test/token_test.dart
|
| index 8f8a20a9058441c7d82117271074142de99281e8..3570fb3d2e120cf416d66ef78680a050abd64ad3 100644
|
| --- a/pkg/front_end/test/token_test.dart
|
| +++ b/pkg/front_end/test/token_test.dart
|
| @@ -29,6 +29,50 @@ class TokenTest {
|
| expect(token.precedingComments.offset, 12);
|
| }
|
|
|
| + void test_comments() {
|
| + var source = '''
|
| +/// Single line dartdoc comment
|
| +class Foo {
|
| + /**
|
| + * Multi-line dartdoc comment
|
| + */
|
| + void bar() {
|
| + // Single line comment
|
| + int x = 0;
|
| + /* Multi-line comment */
|
| + x = x + 1;
|
| + }
|
| +}
|
| +''';
|
| + var scanner = new StringScanner(source, includeComments: true);
|
| + fasta.Token token = scanner.tokenize();
|
| +
|
| + Token nextComment() {
|
| + while (!token.isEof) {
|
| + Token comment = token.precedingComments;
|
| + token = token.next;
|
| + if (comment != null) return comment;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + fasta.Token comment = nextComment();
|
| + expect(comment.lexeme, contains('Single line dartdoc comment'));
|
| + expect(comment.type, TokenType.SINGLE_LINE_COMMENT);
|
| +
|
| + comment = nextComment();
|
| + expect(comment.lexeme, contains('Multi-line dartdoc comment'));
|
| + expect(comment.type, TokenType.MULTI_LINE_COMMENT);
|
| +
|
| + comment = nextComment();
|
| + expect(comment.lexeme, contains('Single line comment'));
|
| + expect(comment.type, TokenType.SINGLE_LINE_COMMENT);
|
| +
|
| + comment = nextComment();
|
| + expect(comment.lexeme, contains('Multi-line comment'));
|
| + expect(comment.type, TokenType.MULTI_LINE_COMMENT);
|
| + }
|
| +
|
| void test_copy() {
|
| String source = '/* 1 */ /* 2 */ main() {print("hello"); return;}';
|
| int commentCount = 0;
|
|
|