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

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

Issue 730533003: Code clean-up and minor bug fix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/enum_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/ast_test.dart
diff --git a/pkg/analyzer/test/generated/ast_test.dart b/pkg/analyzer/test/generated/ast_test.dart
index 0cdbae7a6364508a61b0af26840b06230f4fb6c2..7a4e34cf3f5028d3e2ac4c91ed39442caf5c161d 100644
--- a/pkg/analyzer/test/generated/ast_test.dart
+++ b/pkg/analyzer/test/generated/ast_test.dart
@@ -468,6 +468,81 @@ class ConstantEvaluatorTest extends ParserTestCase {
Object _getConstantValue(String source) => ParserTestCase.parseExpression(source).accept(new ConstantEvaluator());
}
+class ConstructorDeclarationTest extends EngineTestCase {
+ void test_firstTokenAfterCommentAndMetadata_externalOnly() {
+ Token externalKeyword = TokenFactory.tokenFromKeyword(Keyword.EXTERNAL);
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ null,
+ null,
+ AstFactory.identifier3('int'),
+ null,
+ null,
+ null,
+ null);
+ declaration.externalKeyword = externalKeyword;
+ expect(declaration.firstTokenAfterCommentAndMetadata, externalKeyword);
+ }
+
+ void test_firstTokenAfterCommentAndMetadata_constOnly() {
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ Keyword.CONST,
+ null,
+ AstFactory.identifier3('int'),
+ null,
+ null,
+ null,
+ null);
+ expect(declaration.firstTokenAfterCommentAndMetadata, declaration.constKeyword);
+ }
+
+ void test_firstTokenAfterCommentAndMetadata_factoryOnly() {
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ null,
+ Keyword.FACTORY,
+ AstFactory.identifier3('int'),
+ null,
+ null,
+ null,
+ null);
+ expect(declaration.firstTokenAfterCommentAndMetadata, declaration.factoryKeyword);
+ }
+
+ void test_firstTokenAfterCommentAndMetadata_all_inverted() {
+ Token externalKeyword = TokenFactory.tokenFromKeyword(Keyword.EXTERNAL);
+ externalKeyword.offset = 14;
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ Keyword.CONST,
+ Keyword.FACTORY,
+ AstFactory.identifier3('int'),
+ null,
+ null,
+ null,
+ null);
+ declaration.externalKeyword = externalKeyword;
+ declaration.constKeyword.offset = 8;
+ Token factoryKeyword = declaration.factoryKeyword;
+ factoryKeyword.offset = 0;
+ expect(declaration.firstTokenAfterCommentAndMetadata, factoryKeyword);
+ }
+
+ void test_firstTokenAfterCommentAndMetadata_all_normal() {
+ Token token = TokenFactory.tokenFromKeyword(Keyword.EXTERNAL);
+ token.offset = 0;
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ Keyword.CONST,
+ Keyword.FACTORY,
+ AstFactory.identifier3('int'),
+ null,
+ null,
+ null,
+ null);
+ declaration.externalKeyword = token;
+ declaration.constKeyword.offset = 9;
+ declaration.factoryKeyword.offset = 15;
+ expect(declaration.firstTokenAfterCommentAndMetadata, token);
+ }
+}
+
class IndexExpressionTest extends EngineTestCase {
void test_inGetterContext_assignment_compound_left() {
IndexExpression expression = AstFactory.indexExpression(AstFactory.identifier3("a"), AstFactory.identifier3("b"));
@@ -629,14 +704,6 @@ class NodeListTest extends EngineTestCase {
expect(fourthNode.parent, same(parent));
}
- void test_create() {
- AstNode owner = AstFactory.argumentList();
- NodeList<AstNode> list = NodeList.create(owner);
- expect(list, isNotNull);
- expect(list, hasLength(0));
- expect(list.owner, same(owner));
- }
-
void test_creation() {
AstNode owner = AstFactory.argumentList();
NodeList<AstNode> list = new NodeList<AstNode>(owner);
@@ -2645,16 +2712,17 @@ class WrapperKind extends Enum<WrapperKind> {
main() {
groupSep = ' | ';
- runReflectiveTests(ConstantEvaluatorTest);
- runReflectiveTests(NodeLocatorTest);
- runReflectiveTests(ToSourceVisitorTest);
runReflectiveTests(BreadthFirstVisitorTest);
runReflectiveTests(ClassDeclarationTest);
runReflectiveTests(ClassTypeAliasTest);
+ runReflectiveTests(ConstantEvaluatorTest);
+ runReflectiveTests(ConstructorDeclarationTest);
runReflectiveTests(IndexExpressionTest);
runReflectiveTests(NodeListTest);
+ runReflectiveTests(NodeLocatorTest);
runReflectiveTests(SimpleIdentifierTest);
runReflectiveTests(SimpleStringLiteralTest);
runReflectiveTests(StringInterpolationTest);
+ runReflectiveTests(ToSourceVisitorTest);
runReflectiveTests(VariableDeclarationTest);
-}
+}
« no previous file with comments | « pkg/analyzer/test/enum_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698