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

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

Issue 2776733002: Include CompilationUnit begin/endToken(s) with Fasta. (Closed)
Patch Set: Verify begin/endToken(s) of CompilationUnit. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.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/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 13382 matching lines...) Expand 10 before | Expand all | Expand 10 after
13393 } 13393 }
13394 13394
13395 void test_parseCompilationUnit_empty() { 13395 void test_parseCompilationUnit_empty() {
13396 createParser(''); 13396 createParser('');
13397 CompilationUnit unit = parser.parseCompilationUnit2(); 13397 CompilationUnit unit = parser.parseCompilationUnit2();
13398 expect(unit, isNotNull); 13398 expect(unit, isNotNull);
13399 assertNoErrors(); 13399 assertNoErrors();
13400 expect(unit.scriptTag, isNull); 13400 expect(unit.scriptTag, isNull);
13401 expect(unit.directives, hasLength(0)); 13401 expect(unit.directives, hasLength(0));
13402 expect(unit.declarations, hasLength(0)); 13402 expect(unit.declarations, hasLength(0));
13403 expect(unit.beginToken, isNotNull);
13404 expect(unit.endToken, isNotNull);
13405 expect(unit.endToken.type, TokenType.EOF);
13403 } 13406 }
13404 13407
13405 void test_parseCompilationUnit_exportAsPrefix() { 13408 void test_parseCompilationUnit_exportAsPrefix() {
13406 createParser('export.A _export = new export.A();'); 13409 createParser('export.A _export = new export.A();');
13407 CompilationUnit unit = parser.parseCompilationUnit2(); 13410 CompilationUnit unit = parser.parseCompilationUnit2();
13408 expect(unit, isNotNull); 13411 expect(unit, isNotNull);
13409 assertNoErrors(); 13412 assertNoErrors();
13410 expect(unit.scriptTag, isNull); 13413 expect(unit.scriptTag, isNull);
13411 expect(unit.directives, hasLength(0)); 13414 expect(unit.directives, hasLength(0));
13412 expect(unit.declarations, hasLength(1)); 13415 expect(unit.declarations, hasLength(1));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
13453 } 13456 }
13454 13457
13455 void test_parseCompilationUnit_topLevelDeclaration() { 13458 void test_parseCompilationUnit_topLevelDeclaration() {
13456 createParser('class A {}'); 13459 createParser('class A {}');
13457 CompilationUnit unit = parser.parseCompilationUnit2(); 13460 CompilationUnit unit = parser.parseCompilationUnit2();
13458 expect(unit, isNotNull); 13461 expect(unit, isNotNull);
13459 assertNoErrors(); 13462 assertNoErrors();
13460 expect(unit.scriptTag, isNull); 13463 expect(unit.scriptTag, isNull);
13461 expect(unit.directives, hasLength(0)); 13464 expect(unit.directives, hasLength(0));
13462 expect(unit.declarations, hasLength(1)); 13465 expect(unit.declarations, hasLength(1));
13466 expect(unit.beginToken, isNotNull);
13467 expect(unit.beginToken.keyword, Keyword.CLASS);
13468 expect(unit.endToken, isNotNull);
13469 expect(unit.endToken.type, TokenType.EOF);
13463 } 13470 }
13464 13471
13465 void test_parseCompilationUnit_typedefAsPrefix() { 13472 void test_parseCompilationUnit_typedefAsPrefix() {
13466 createParser('typedef.A _typedef = new typedef.A();'); 13473 createParser('typedef.A _typedef = new typedef.A();');
13467 CompilationUnit unit = parser.parseCompilationUnit2(); 13474 CompilationUnit unit = parser.parseCompilationUnit2();
13468 expect(unit, isNotNull); 13475 expect(unit, isNotNull);
13469 assertNoErrors(); 13476 assertNoErrors();
13470 expect(unit.scriptTag, isNull); 13477 expect(unit.scriptTag, isNull);
13471 expect(unit.directives, hasLength(0)); 13478 expect(unit.directives, hasLength(0));
13472 expect(unit.declarations, hasLength(1)); 13479 expect(unit.declarations, hasLength(1));
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
14770 expectCommentText(typeVariable.documentationComment, '/// Doc'); 14777 expectCommentText(typeVariable.documentationComment, '/// Doc');
14771 } 14778 }
14772 14779
14773 /** 14780 /**
14774 * Assert that the given [name] is in declaration context. 14781 * Assert that the given [name] is in declaration context.
14775 */ 14782 */
14776 void _assertIsDeclarationName(SimpleIdentifier name) { 14783 void _assertIsDeclarationName(SimpleIdentifier name) {
14777 expect(name.inDeclarationContext(), isTrue); 14784 expect(name.inDeclarationContext(), isTrue);
14778 } 14785 }
14779 } 14786 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698