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

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

Issue 686793002: Replace EngineTestCase.assertSize() with hasLength(). (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 unified diff | Download patch | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser_test; 8 library engine.parser_test;
9 9
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void test_assignableExpression_arguments_normal_chain() { 145 void test_assignableExpression_arguments_normal_chain() {
146 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []); 146 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []);
147 expect(propertyAccess1.propertyName.name, "f"); 147 expect(propertyAccess1.propertyName.name, "f");
148 // 148 //
149 // a(b)(c).d(e) 149 // a(b)(c).d(e)
150 // 150 //
151 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, propertyAccess1.target); 151 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, propertyAccess1.target);
152 expect(invocation2.methodName.name, "d"); 152 expect(invocation2.methodName.name, "d");
153 ArgumentList argumentList2 = invocation2.argumentList; 153 ArgumentList argumentList2 = invocation2.argumentList;
154 expect(argumentList2, isNotNull); 154 expect(argumentList2, isNotNull);
155 EngineTestCase.assertSizeOfList(1, argumentList2.arguments); 155 expect(argumentList2.arguments, hasLength(1));
156 // 156 //
157 // a(b)(c) 157 // a(b)(c)
158 // 158 //
159 FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf(( obj) => obj is FunctionExpressionInvocation, FunctionExpressionInvocation, invoc ation2.target); 159 FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf(( obj) => obj is FunctionExpressionInvocation, FunctionExpressionInvocation, invoc ation2.target);
160 ArgumentList argumentList3 = invocation3.argumentList; 160 ArgumentList argumentList3 = invocation3.argumentList;
161 expect(argumentList3, isNotNull); 161 expect(argumentList3, isNotNull);
162 EngineTestCase.assertSizeOfList(1, argumentList3.arguments); 162 expect(argumentList3.arguments, hasLength(1));
163 // 163 //
164 // a(b) 164 // a(b)
165 // 165 //
166 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, invocation3.function); 166 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, invocation3.function);
167 expect(invocation4.methodName.name, "a"); 167 expect(invocation4.methodName.name, "a");
168 ArgumentList argumentList4 = invocation4.argumentList; 168 ArgumentList argumentList4 = invocation4.argumentList;
169 expect(argumentList4, isNotNull); 169 expect(argumentList4, isNotNull);
170 EngineTestCase.assertSizeOfList(1, argumentList4.arguments); 170 expect(argumentList4.arguments, hasLength(1));
171 } 171 }
172 172
173 void test_assignmentExpression_compound() { 173 void test_assignmentExpression_compound() {
174 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []); 174 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []);
175 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide); 175 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide);
176 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assign mentExpression, expression.rightHandSide); 176 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assign mentExpression, expression.rightHandSide);
177 } 177 }
178 178
179 void test_assignmentExpression_indexExpression() { 179 void test_assignmentExpression_indexExpression() {
180 AssignmentExpression expression = ParserTestCase.parseExpression("x[1] = 0", []); 180 AssignmentExpression expression = ParserTestCase.parseExpression("x[1] = 0", []);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 void test_constructor_initializer_withParenthesizedExpression() { 275 void test_constructor_initializer_withParenthesizedExpression() {
276 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 276 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
277 class C { 277 class C {
278 C() : 278 C() :
279 this.a = (b == null ? c : d) { 279 this.a = (b == null ? c : d) {
280 } 280 }
281 }''', []); 281 }''', []);
282 NodeList<CompilationUnitMember> declarations = unit.declarations; 282 NodeList<CompilationUnitMember> declarations = unit.declarations;
283 EngineTestCase.assertSizeOfList(1, declarations); 283 expect(declarations, hasLength(1));
284 } 284 }
285 285
286 void test_equalityExpression_normal() { 286 void test_equalityExpression_normal() {
287 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 287 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
288 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 288 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
289 } 289 }
290 290
291 void test_equalityExpression_precedence_relational_left() { 291 void test_equalityExpression_precedence_relational_left() {
292 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []); 292 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []);
293 EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand); 293 EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 328 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
329 } 329 }
330 330
331 void test_logicalOrExpression_precedence_logicalAnd_right() { 331 void test_logicalOrExpression_precedence_logicalAnd_right() {
332 BinaryExpression expression = ParserTestCase.parseExpression("x || y && z", []); 332 BinaryExpression expression = ParserTestCase.parseExpression("x || y && z", []);
333 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 333 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
334 } 334 }
335 335
336 void test_multipleLabels_statement() { 336 void test_multipleLabels_statement() {
337 LabeledStatement statement = ParserTestCase.parseStatement("a: b: c: return x;", []); 337 LabeledStatement statement = ParserTestCase.parseStatement("a: b: c: return x;", []);
338 EngineTestCase.assertSizeOfList(3, statement.labels); 338 expect(statement.labels, hasLength(3));
339 EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnState ment, statement.statement); 339 EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnState ment, statement.statement);
340 } 340 }
341 341
342 void test_multiplicativeExpression_normal() { 342 void test_multiplicativeExpression_normal() {
343 BinaryExpression expression = ParserTestCase.parseExpression("x * y / z", [] ); 343 BinaryExpression expression = ParserTestCase.parseExpression("x * y / z", [] );
344 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 344 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
345 } 345 }
346 346
347 void test_multiplicativeExpression_precedence_unary_left() { 347 void test_multiplicativeExpression_precedence_unary_left() {
348 BinaryExpression expression = ParserTestCase.parseExpression("-x * y", []); 348 BinaryExpression expression = ParserTestCase.parseExpression("-x * y", []);
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 } 1334 }
1335 1335
1336 void test_optionalAfterNormalParameters_positional() { 1336 void test_optionalAfterNormalParameters_positional() {
1337 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 1337 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
1338 } 1338 }
1339 1339
1340 void test_parseCascadeSection_missingIdentifier() { 1340 void test_parseCascadeSection_missingIdentifier() {
1341 MethodInvocation methodInvocation = ParserTestCase.parse4("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]); 1341 MethodInvocation methodInvocation = ParserTestCase.parse4("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]);
1342 expect(methodInvocation.target, isNull); 1342 expect(methodInvocation.target, isNull);
1343 expect(methodInvocation.methodName.name, ""); 1343 expect(methodInvocation.methodName.name, "");
1344 EngineTestCase.assertSizeOfList(0, methodInvocation.argumentList.arguments); 1344 expect(methodInvocation.argumentList.arguments, hasLength(0));
1345 } 1345 }
1346 1346
1347 void test_positionalAfterNamedArgument() { 1347 void test_positionalAfterNamedArgument() {
1348 ParserTestCase.parse4("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]); 1348 ParserTestCase.parse4("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]);
1349 } 1349 }
1350 1350
1351 void test_positionalParameterOutsideGroup() { 1351 void test_positionalParameterOutsideGroup() {
1352 ParserTestCase.parse4("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]); 1352 ParserTestCase.parse4("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
1353 } 1353 }
1354 1354
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 * the expected count, if the compilation errors in the source do no t match those that 2006 * the expected count, if the compilation errors in the source do no t match those that
2007 * are expected, or if the result would have been `null` 2007 * are expected, or if the result would have been `null`
2008 */ 2008 */
2009 static List<Statement> parseStatements(String source, int expectedCount, List< ErrorCode> errorCodes) { 2009 static List<Statement> parseStatements(String source, int expectedCount, List< ErrorCode> errorCodes) {
2010 GatheringErrorListener listener = new GatheringErrorListener(); 2010 GatheringErrorListener listener = new GatheringErrorListener();
2011 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 2011 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
2012 listener.setLineInfo(new TestSource(), scanner.lineStarts); 2012 listener.setLineInfo(new TestSource(), scanner.lineStarts);
2013 Token token = scanner.tokenize(); 2013 Token token = scanner.tokenize();
2014 Parser parser = createParser(listener); 2014 Parser parser = createParser(listener);
2015 List<Statement> statements = parser.parseStatements(token); 2015 List<Statement> statements = parser.parseStatements(token);
2016 EngineTestCase.assertSizeOfList(expectedCount, statements); 2016 expect(statements, hasLength(expectedCount));
2017 listener.assertErrorsWithCodes(errorCodes); 2017 listener.assertErrorsWithCodes(errorCodes);
2018 return statements; 2018 return statements;
2019 } 2019 }
2020 2020
2021 /** 2021 /**
2022 * Invoke a method in [Parser]. The method is assumed to have the given number and type of 2022 * Invoke a method in [Parser]. The method is assumed to have the given number and type of
2023 * parameters and will be invoked with the given arguments. 2023 * parameters and will be invoked with the given arguments.
2024 * 2024 *
2025 * The given source is scanned and the parser is initialized to start with the first token in the 2025 * The given source is scanned and the parser is initialized to start with the first token in the
2026 * source before the method is invoked. 2026 * source before the method is invoked.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 void test_equalityExpression_super() { 2422 void test_equalityExpression_super() {
2423 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ 2423 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
2424 ParserErrorCode.MISSING_IDENTIFIER, 2424 ParserErrorCode.MISSING_IDENTIFIER,
2425 ParserErrorCode.MISSING_IDENTIFIER, 2425 ParserErrorCode.MISSING_IDENTIFIER,
2426 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 2426 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
2427 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2427 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2428 } 2428 }
2429 2429
2430 void test_expressionList_multiple_end() { 2430 void test_expressionList_multiple_end() {
2431 List<Expression> result = ParserTestCase.parse4("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]); 2431 List<Expression> result = ParserTestCase.parse4("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
2432 EngineTestCase.assertSizeOfList(4, result); 2432 expect(result, hasLength(4));
2433 Expression syntheticExpression = result[0]; 2433 Expression syntheticExpression = result[0];
2434 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2434 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2435 expect(syntheticExpression.isSynthetic, isTrue); 2435 expect(syntheticExpression.isSynthetic, isTrue);
2436 } 2436 }
2437 2437
2438 void test_expressionList_multiple_middle() { 2438 void test_expressionList_multiple_middle() {
2439 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , , 4", [ParserErrorCode.MISSING_IDENTIFIER]); 2439 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , , 4", [ParserErrorCode.MISSING_IDENTIFIER]);
2440 EngineTestCase.assertSizeOfList(4, result); 2440 expect(result, hasLength(4));
2441 Expression syntheticExpression = result[2]; 2441 Expression syntheticExpression = result[2];
2442 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2442 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2443 expect(syntheticExpression.isSynthetic, isTrue); 2443 expect(syntheticExpression.isSynthetic, isTrue);
2444 } 2444 }
2445 2445
2446 void test_expressionList_multiple_start() { 2446 void test_expressionList_multiple_start() {
2447 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3,", [ParserErrorCode.MISSING_IDENTIFIER]); 2447 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3,", [ParserErrorCode.MISSING_IDENTIFIER]);
2448 EngineTestCase.assertSizeOfList(4, result); 2448 expect(result, hasLength(4));
2449 Expression syntheticExpression = result[3]; 2449 Expression syntheticExpression = result[3];
2450 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2450 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2451 expect(syntheticExpression.isSynthetic, isTrue); 2451 expect(syntheticExpression.isSynthetic, isTrue);
2452 } 2452 }
2453 2453
2454 void test_functionExpression_in_ConstructorFieldInitializer() { 2454 void test_functionExpression_in_ConstructorFieldInitializer() {
2455 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class A { A() : a = (){}; var v; }", [ 2455 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class A { A() : a = (){}; var v; }", [
2456 ParserErrorCode.MISSING_IDENTIFIER, 2456 ParserErrorCode.MISSING_IDENTIFIER,
2457 ParserErrorCode.UNEXPECTED_TOKEN]); 2457 ParserErrorCode.UNEXPECTED_TOKEN]);
2458 // Make sure we recovered and parsed "var v" correctly 2458 // Make sure we recovered and parsed "var v" correctly
2459 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 2459 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
2460 NodeList<ClassMember> members = declaration.members; 2460 NodeList<ClassMember> members = declaration.members;
2461 ClassMember fieldDecl = members[1]; 2461 ClassMember fieldDecl = members[1];
2462 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, fieldDecl); 2462 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, fieldDecl);
2463 NodeList<VariableDeclaration> vars = (fieldDecl as FieldDeclaration).fields. variables; 2463 NodeList<VariableDeclaration> vars = (fieldDecl as FieldDeclaration).fields. variables;
2464 EngineTestCase.assertSizeOfList(1, vars); 2464 expect(vars, hasLength(1));
2465 expect(vars[0].name.name, "v"); 2465 expect(vars[0].name.name, "v");
2466 } 2466 }
2467 2467
2468 void test_incomplete_topLevelVariable() { 2468 void test_incomplete_topLevelVariable() {
2469 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]); 2469 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]);
2470 NodeList<CompilationUnitMember> declarations = unit.declarations; 2470 NodeList<CompilationUnitMember> declarations = unit.declarations;
2471 EngineTestCase.assertSizeOfList(1, declarations); 2471 expect(declarations, hasLength(1));
2472 CompilationUnitMember member = declarations[0]; 2472 CompilationUnitMember member = declarations[0];
2473 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2473 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2474 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2474 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2475 EngineTestCase.assertSizeOfList(1, variables); 2475 expect(variables, hasLength(1));
2476 SimpleIdentifier name = variables[0].name; 2476 SimpleIdentifier name = variables[0].name;
2477 expect(name.isSynthetic, isTrue); 2477 expect(name.isSynthetic, isTrue);
2478 } 2478 }
2479 2479
2480 void test_incomplete_topLevelVariable_const() { 2480 void test_incomplete_topLevelVariable_const() {
2481 CompilationUnit unit = ParserTestCase.parseCompilationUnit("const ", [ 2481 CompilationUnit unit = ParserTestCase.parseCompilationUnit("const ", [
2482 ParserErrorCode.MISSING_IDENTIFIER, 2482 ParserErrorCode.MISSING_IDENTIFIER,
2483 ParserErrorCode.EXPECTED_TOKEN]); 2483 ParserErrorCode.EXPECTED_TOKEN]);
2484 NodeList<CompilationUnitMember> declarations = unit.declarations; 2484 NodeList<CompilationUnitMember> declarations = unit.declarations;
2485 EngineTestCase.assertSizeOfList(1, declarations); 2485 expect(declarations, hasLength(1));
2486 CompilationUnitMember member = declarations[0]; 2486 CompilationUnitMember member = declarations[0];
2487 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2487 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2488 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2488 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2489 EngineTestCase.assertSizeOfList(1, variables); 2489 expect(variables, hasLength(1));
2490 SimpleIdentifier name = variables[0].name; 2490 SimpleIdentifier name = variables[0].name;
2491 expect(name.isSynthetic, isTrue); 2491 expect(name.isSynthetic, isTrue);
2492 } 2492 }
2493 2493
2494 void test_incomplete_topLevelVariable_final() { 2494 void test_incomplete_topLevelVariable_final() {
2495 CompilationUnit unit = ParserTestCase.parseCompilationUnit("final ", [ 2495 CompilationUnit unit = ParserTestCase.parseCompilationUnit("final ", [
2496 ParserErrorCode.MISSING_IDENTIFIER, 2496 ParserErrorCode.MISSING_IDENTIFIER,
2497 ParserErrorCode.EXPECTED_TOKEN]); 2497 ParserErrorCode.EXPECTED_TOKEN]);
2498 NodeList<CompilationUnitMember> declarations = unit.declarations; 2498 NodeList<CompilationUnitMember> declarations = unit.declarations;
2499 EngineTestCase.assertSizeOfList(1, declarations); 2499 expect(declarations, hasLength(1));
2500 CompilationUnitMember member = declarations[0]; 2500 CompilationUnitMember member = declarations[0];
2501 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2501 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2502 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2502 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2503 EngineTestCase.assertSizeOfList(1, variables); 2503 expect(variables, hasLength(1));
2504 SimpleIdentifier name = variables[0].name; 2504 SimpleIdentifier name = variables[0].name;
2505 expect(name.isSynthetic, isTrue); 2505 expect(name.isSynthetic, isTrue);
2506 } 2506 }
2507 2507
2508 void test_incomplete_topLevelVariable_var() { 2508 void test_incomplete_topLevelVariable_var() {
2509 CompilationUnit unit = ParserTestCase.parseCompilationUnit("var ", [ 2509 CompilationUnit unit = ParserTestCase.parseCompilationUnit("var ", [
2510 ParserErrorCode.MISSING_IDENTIFIER, 2510 ParserErrorCode.MISSING_IDENTIFIER,
2511 ParserErrorCode.EXPECTED_TOKEN]); 2511 ParserErrorCode.EXPECTED_TOKEN]);
2512 NodeList<CompilationUnitMember> declarations = unit.declarations; 2512 NodeList<CompilationUnitMember> declarations = unit.declarations;
2513 EngineTestCase.assertSizeOfList(1, declarations); 2513 expect(declarations, hasLength(1));
2514 CompilationUnitMember member = declarations[0]; 2514 CompilationUnitMember member = declarations[0];
2515 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2515 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2516 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2516 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2517 EngineTestCase.assertSizeOfList(1, variables); 2517 expect(variables, hasLength(1));
2518 SimpleIdentifier name = variables[0].name; 2518 SimpleIdentifier name = variables[0].name;
2519 expect(name.isSynthetic, isTrue); 2519 expect(name.isSynthetic, isTrue);
2520 } 2520 }
2521 2521
2522 void test_incompleteField_const() { 2522 void test_incompleteField_const() {
2523 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2523 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2524 class C { 2524 class C {
2525 const 2525 const
2526 }''', [ 2526 }''', [
2527 ParserErrorCode.MISSING_IDENTIFIER, 2527 ParserErrorCode.MISSING_IDENTIFIER,
2528 ParserErrorCode.EXPECTED_TOKEN]); 2528 ParserErrorCode.EXPECTED_TOKEN]);
2529 NodeList<CompilationUnitMember> declarations = unit.declarations; 2529 NodeList<CompilationUnitMember> declarations = unit.declarations;
2530 EngineTestCase.assertSizeOfList(1, declarations); 2530 expect(declarations, hasLength(1));
2531 CompilationUnitMember unitMember = declarations[0]; 2531 CompilationUnitMember unitMember = declarations[0];
2532 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2532 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2533 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2533 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2534 EngineTestCase.assertSizeOfList(1, members); 2534 expect(members, hasLength(1));
2535 ClassMember classMember = members[0]; 2535 ClassMember classMember = members[0];
2536 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2536 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2537 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2537 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2538 expect((fieldList.keyword as KeywordToken).keyword, Keyword.CONST); 2538 expect((fieldList.keyword as KeywordToken).keyword, Keyword.CONST);
2539 NodeList<VariableDeclaration> fields = fieldList.variables; 2539 NodeList<VariableDeclaration> fields = fieldList.variables;
2540 EngineTestCase.assertSizeOfList(1, fields); 2540 expect(fields, hasLength(1));
2541 VariableDeclaration field = fields[0]; 2541 VariableDeclaration field = fields[0];
2542 expect(field.name.isSynthetic, isTrue); 2542 expect(field.name.isSynthetic, isTrue);
2543 } 2543 }
2544 2544
2545 void test_incompleteField_final() { 2545 void test_incompleteField_final() {
2546 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2546 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2547 class C { 2547 class C {
2548 final 2548 final
2549 }''', [ 2549 }''', [
2550 ParserErrorCode.MISSING_IDENTIFIER, 2550 ParserErrorCode.MISSING_IDENTIFIER,
2551 ParserErrorCode.EXPECTED_TOKEN]); 2551 ParserErrorCode.EXPECTED_TOKEN]);
2552 NodeList<CompilationUnitMember> declarations = unit.declarations; 2552 NodeList<CompilationUnitMember> declarations = unit.declarations;
2553 EngineTestCase.assertSizeOfList(1, declarations); 2553 expect(declarations, hasLength(1));
2554 CompilationUnitMember unitMember = declarations[0]; 2554 CompilationUnitMember unitMember = declarations[0];
2555 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2555 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2556 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2556 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2557 EngineTestCase.assertSizeOfList(1, members); 2557 expect(members, hasLength(1));
2558 ClassMember classMember = members[0]; 2558 ClassMember classMember = members[0];
2559 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2559 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2560 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2560 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2561 expect((fieldList.keyword as KeywordToken).keyword, Keyword.FINAL); 2561 expect((fieldList.keyword as KeywordToken).keyword, Keyword.FINAL);
2562 NodeList<VariableDeclaration> fields = fieldList.variables; 2562 NodeList<VariableDeclaration> fields = fieldList.variables;
2563 EngineTestCase.assertSizeOfList(1, fields); 2563 expect(fields, hasLength(1));
2564 VariableDeclaration field = fields[0]; 2564 VariableDeclaration field = fields[0];
2565 expect(field.name.isSynthetic, isTrue); 2565 expect(field.name.isSynthetic, isTrue);
2566 } 2566 }
2567 2567
2568 void test_incompleteField_var() { 2568 void test_incompleteField_var() {
2569 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2569 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2570 class C { 2570 class C {
2571 var 2571 var
2572 }''', [ 2572 }''', [
2573 ParserErrorCode.MISSING_IDENTIFIER, 2573 ParserErrorCode.MISSING_IDENTIFIER,
2574 ParserErrorCode.EXPECTED_TOKEN]); 2574 ParserErrorCode.EXPECTED_TOKEN]);
2575 NodeList<CompilationUnitMember> declarations = unit.declarations; 2575 NodeList<CompilationUnitMember> declarations = unit.declarations;
2576 EngineTestCase.assertSizeOfList(1, declarations); 2576 expect(declarations, hasLength(1));
2577 CompilationUnitMember unitMember = declarations[0]; 2577 CompilationUnitMember unitMember = declarations[0];
2578 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2578 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2579 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2579 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2580 EngineTestCase.assertSizeOfList(1, members); 2580 expect(members, hasLength(1));
2581 ClassMember classMember = members[0]; 2581 ClassMember classMember = members[0];
2582 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2582 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2583 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2583 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2584 expect((fieldList.keyword as KeywordToken).keyword, Keyword.VAR); 2584 expect((fieldList.keyword as KeywordToken).keyword, Keyword.VAR);
2585 NodeList<VariableDeclaration> fields = fieldList.variables; 2585 NodeList<VariableDeclaration> fields = fieldList.variables;
2586 EngineTestCase.assertSizeOfList(1, fields); 2586 expect(fields, hasLength(1));
2587 VariableDeclaration field = fields[0]; 2587 VariableDeclaration field = fields[0];
2588 expect(field.name.isSynthetic, isTrue); 2588 expect(field.name.isSynthetic, isTrue);
2589 } 2589 }
2590 2590
2591 void test_isExpression_noType() { 2591 void test_isExpression_noType() {
2592 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [ 2592 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [
2593 ParserErrorCode.EXPECTED_TYPE_NAME, 2593 ParserErrorCode.EXPECTED_TYPE_NAME,
2594 ParserErrorCode.EXPECTED_TYPE_NAME, 2594 ParserErrorCode.EXPECTED_TYPE_NAME,
2595 ParserErrorCode.MISSING_STATEMENT]); 2595 ParserErrorCode.MISSING_STATEMENT]);
2596 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 2596 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 2685
2686 void test_missingGet() { 2686 void test_missingGet() {
2687 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2687 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2688 class C { 2688 class C {
2689 int length {} 2689 int length {}
2690 void foo() {} 2690 void foo() {}
2691 }''', [ParserErrorCode.MISSING_GET]); 2691 }''', [ParserErrorCode.MISSING_GET]);
2692 expect(unit, isNotNull); 2692 expect(unit, isNotNull);
2693 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration ; 2693 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration ;
2694 NodeList<ClassMember> members = classDeclaration.members; 2694 NodeList<ClassMember> members = classDeclaration.members;
2695 EngineTestCase.assertSizeOfList(2, members); 2695 expect(members, hasLength(2));
2696 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, members[0]); 2696 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, members[0]);
2697 ClassMember member = members[1]; 2697 ClassMember member = members[1];
2698 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, member); 2698 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, member);
2699 expect((member as MethodDeclaration).name.name, "foo"); 2699 expect((member as MethodDeclaration).name.name, "foo");
2700 } 2700 }
2701 2701
2702 void test_missingIdentifier_afterAnnotation() { 2702 void test_missingIdentifier_afterAnnotation() {
2703 MethodDeclaration method = ParserTestCase.parse3("parseClassMember", <Object > ["C"], "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]); 2703 MethodDeclaration method = ParserTestCase.parse3("parseClassMember", <Object > ["C"], "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
2704 expect(method.documentationComment, isNull); 2704 expect(method.documentationComment, isNull);
2705 NodeList<Annotation> metadata = method.metadata; 2705 NodeList<Annotation> metadata = method.metadata;
2706 EngineTestCase.assertSizeOfList(1, metadata); 2706 expect(metadata, hasLength(1));
2707 expect(metadata[0].name.name, "override"); 2707 expect(metadata[0].name.name, "override");
2708 } 2708 }
2709 2709
2710 void test_multiplicativeExpression_missing_LHS() { 2710 void test_multiplicativeExpression_missing_LHS() {
2711 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2711 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2712 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2712 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2713 expect(expression.leftOperand.isSynthetic, isTrue); 2713 expect(expression.leftOperand.isSynthetic, isTrue);
2714 } 2714 }
2715 2715
2716 void test_multiplicativeExpression_missing_LHS_RHS() { 2716 void test_multiplicativeExpression_missing_LHS_RHS() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 ParserErrorCode.MISSING_IDENTIFIER, 2844 ParserErrorCode.MISSING_IDENTIFIER,
2845 ParserErrorCode.MISSING_IDENTIFIER]); 2845 ParserErrorCode.MISSING_IDENTIFIER]);
2846 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2846 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2847 } 2847 }
2848 2848
2849 void test_typedef_eof() { 2849 void test_typedef_eof() {
2850 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [ 2850 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [
2851 ParserErrorCode.EXPECTED_TOKEN, 2851 ParserErrorCode.EXPECTED_TOKEN,
2852 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]); 2852 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
2853 NodeList<CompilationUnitMember> declarations = unit.declarations; 2853 NodeList<CompilationUnitMember> declarations = unit.declarations;
2854 EngineTestCase.assertSizeOfList(1, declarations); 2854 expect(declarations, hasLength(1));
2855 CompilationUnitMember member = declarations[0]; 2855 CompilationUnitMember member = declarations[0];
2856 EngineTestCase.assertInstanceOf((obj) => obj is FunctionTypeAlias, FunctionT ypeAlias, member); 2856 EngineTestCase.assertInstanceOf((obj) => obj is FunctionTypeAlias, FunctionT ypeAlias, member);
2857 } 2857 }
2858 } 2858 }
2859 2859
2860 class ResolutionCopierTest extends EngineTestCase { 2860 class ResolutionCopierTest extends EngineTestCase {
2861 void test_visitAnnotation() { 2861 void test_visitAnnotation() {
2862 String annotationName = "proxy"; 2862 String annotationName = "proxy";
2863 Annotation fromNode = AstFactory.annotation(AstFactory.identifier3(annotatio nName)); 2863 Annotation fromNode = AstFactory.annotation(AstFactory.identifier3(annotatio nName));
2864 Element element = ElementFactory.topLevelVariableElement2(annotationName); 2864 Element element = ElementFactory.topLevelVariableElement2(annotationName);
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
3782 3782
3783 void test_parseArgument_unnamed() { 3783 void test_parseArgument_unnamed() {
3784 String lexeme = "x"; 3784 String lexeme = "x";
3785 SimpleIdentifier identifier = ParserTestCase.parse4("parseArgument", lexeme, []); 3785 SimpleIdentifier identifier = ParserTestCase.parse4("parseArgument", lexeme, []);
3786 expect(identifier.name, lexeme); 3786 expect(identifier.name, lexeme);
3787 } 3787 }
3788 3788
3789 void test_parseArgumentList_empty() { 3789 void test_parseArgumentList_empty() {
3790 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "()", []); 3790 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "()", []);
3791 NodeList<Expression> arguments = argumentList.arguments; 3791 NodeList<Expression> arguments = argumentList.arguments;
3792 EngineTestCase.assertSizeOfList(0, arguments); 3792 expect(arguments, hasLength(0));
3793 } 3793 }
3794 3794
3795 void test_parseArgumentList_mixed() { 3795 void test_parseArgumentList_mixed() {
3796 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(w, x, y: y, z: z)", []); 3796 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(w, x, y: y, z: z)", []);
3797 NodeList<Expression> arguments = argumentList.arguments; 3797 NodeList<Expression> arguments = argumentList.arguments;
3798 EngineTestCase.assertSizeOfList(4, arguments); 3798 expect(arguments, hasLength(4));
3799 } 3799 }
3800 3800
3801 void test_parseArgumentList_noNamed() { 3801 void test_parseArgumentList_noNamed() {
3802 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x, y, z)", []); 3802 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x, y, z)", []);
3803 NodeList<Expression> arguments = argumentList.arguments; 3803 NodeList<Expression> arguments = argumentList.arguments;
3804 EngineTestCase.assertSizeOfList(3, arguments); 3804 expect(arguments, hasLength(3));
3805 } 3805 }
3806 3806
3807 void test_parseArgumentList_onlyNamed() { 3807 void test_parseArgumentList_onlyNamed() {
3808 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x: x, y: y)", []); 3808 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x: x, y: y)", []);
3809 NodeList<Expression> arguments = argumentList.arguments; 3809 NodeList<Expression> arguments = argumentList.arguments;
3810 EngineTestCase.assertSizeOfList(2, arguments); 3810 expect(arguments, hasLength(2));
3811 } 3811 }
3812 3812
3813 void test_parseAssertStatement() { 3813 void test_parseAssertStatement() {
3814 AssertStatement statement = ParserTestCase.parse4("parseAssertStatement", "a ssert (x);", []); 3814 AssertStatement statement = ParserTestCase.parse4("parseAssertStatement", "a ssert (x);", []);
3815 expect(statement.keyword, isNotNull); 3815 expect(statement.keyword, isNotNull);
3816 expect(statement.leftParenthesis, isNotNull); 3816 expect(statement.leftParenthesis, isNotNull);
3817 expect(statement.condition, isNotNull); 3817 expect(statement.condition, isNotNull);
3818 expect(statement.rightParenthesis, isNotNull); 3818 expect(statement.rightParenthesis, isNotNull);
3819 expect(statement.semicolon, isNotNull); 3819 expect(statement.semicolon, isNotNull);
3820 } 3820 }
3821 3821
3822 void test_parseAssignableExpression_expression_args_dot() { 3822 void test_parseAssignableExpression_expression_args_dot() {
3823 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z"); 3823 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z");
3824 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation; 3824 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation;
3825 expect(invocation.function, isNotNull); 3825 expect(invocation.function, isNotNull);
3826 ArgumentList argumentList = invocation.argumentList; 3826 ArgumentList argumentList = invocation.argumentList;
3827 expect(argumentList, isNotNull); 3827 expect(argumentList, isNotNull);
3828 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 3828 expect(argumentList.arguments, hasLength(1));
3829 expect(propertyAccess.operator, isNotNull); 3829 expect(propertyAccess.operator, isNotNull);
3830 expect(propertyAccess.propertyName, isNotNull); 3830 expect(propertyAccess.propertyName, isNotNull);
3831 } 3831 }
3832 3832
3833 void test_parseAssignableExpression_expression_dot() { 3833 void test_parseAssignableExpression_expression_dot() {
3834 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y"); 3834 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y");
3835 expect(propertyAccess.target, isNotNull); 3835 expect(propertyAccess.target, isNotNull);
3836 expect(propertyAccess.operator, isNotNull); 3836 expect(propertyAccess.operator, isNotNull);
3837 expect(propertyAccess.propertyName, isNotNull); 3837 expect(propertyAccess.propertyName, isNotNull);
3838 } 3838 }
(...skipping 10 matching lines...) Expand all
3849 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x"); 3849 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x");
3850 expect(identifier, isNotNull); 3850 expect(identifier, isNotNull);
3851 } 3851 }
3852 3852
3853 void test_parseAssignableExpression_identifier_args_dot() { 3853 void test_parseAssignableExpression_identifier_args_dot() {
3854 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z"); 3854 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z");
3855 MethodInvocation invocation = propertyAccess.target as MethodInvocation; 3855 MethodInvocation invocation = propertyAccess.target as MethodInvocation;
3856 expect(invocation.methodName.name, "x"); 3856 expect(invocation.methodName.name, "x");
3857 ArgumentList argumentList = invocation.argumentList; 3857 ArgumentList argumentList = invocation.argumentList;
3858 expect(argumentList, isNotNull); 3858 expect(argumentList, isNotNull);
3859 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 3859 expect(argumentList.arguments, hasLength(1));
3860 expect(propertyAccess.operator, isNotNull); 3860 expect(propertyAccess.operator, isNotNull);
3861 expect(propertyAccess.propertyName, isNotNull); 3861 expect(propertyAccess.propertyName, isNotNull);
3862 } 3862 }
3863 3863
3864 void test_parseAssignableExpression_identifier_dot() { 3864 void test_parseAssignableExpression_identifier_dot() {
3865 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y"); 3865 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y");
3866 expect(propertyAccess.target, isNotNull); 3866 expect(propertyAccess.target, isNotNull);
3867 expect(propertyAccess.operator, isNotNull); 3867 expect(propertyAccess.operator, isNotNull);
3868 expect(propertyAccess.propertyName, isNotNull); 3868 expect(propertyAccess.propertyName, isNotNull);
3869 } 3869 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3991 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "super ^ y", []); 3991 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "super ^ y", []);
3992 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 3992 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
3993 expect(expression.operator, isNotNull); 3993 expect(expression.operator, isNotNull);
3994 expect(expression.operator.type, TokenType.CARET); 3994 expect(expression.operator.type, TokenType.CARET);
3995 expect(expression.rightOperand, isNotNull); 3995 expect(expression.rightOperand, isNotNull);
3996 } 3996 }
3997 3997
3998 void test_parseBlock_empty() { 3998 void test_parseBlock_empty() {
3999 Block block = ParserTestCase.parse4("parseBlock", "{}", []); 3999 Block block = ParserTestCase.parse4("parseBlock", "{}", []);
4000 expect(block.leftBracket, isNotNull); 4000 expect(block.leftBracket, isNotNull);
4001 EngineTestCase.assertSizeOfList(0, block.statements); 4001 expect(block.statements, hasLength(0));
4002 expect(block.rightBracket, isNotNull); 4002 expect(block.rightBracket, isNotNull);
4003 } 4003 }
4004 4004
4005 void test_parseBlock_nonEmpty() { 4005 void test_parseBlock_nonEmpty() {
4006 Block block = ParserTestCase.parse4("parseBlock", "{;}", []); 4006 Block block = ParserTestCase.parse4("parseBlock", "{;}", []);
4007 expect(block.leftBracket, isNotNull); 4007 expect(block.leftBracket, isNotNull);
4008 EngineTestCase.assertSizeOfList(1, block.statements); 4008 expect(block.statements, hasLength(1));
4009 expect(block.rightBracket, isNotNull); 4009 expect(block.rightBracket, isNotNull);
4010 } 4010 }
4011 4011
4012 void test_parseBreakStatement_label() { 4012 void test_parseBreakStatement_label() {
4013 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak foo;", []); 4013 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak foo;", []);
4014 expect(statement.keyword, isNotNull); 4014 expect(statement.keyword, isNotNull);
4015 expect(statement.label, isNotNull); 4015 expect(statement.label, isNotNull);
4016 expect(statement.semicolon, isNotNull); 4016 expect(statement.semicolon, isNotNull);
4017 } 4017 }
4018 4018
(...skipping 17 matching lines...) Expand all
4036 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpres sion, section.function); 4036 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpres sion, section.function);
4037 expect(section.argumentList, isNotNull); 4037 expect(section.argumentList, isNotNull);
4038 } 4038 }
4039 4039
4040 void test_parseCascadeSection_ii() { 4040 void test_parseCascadeSection_ii() {
4041 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b).c(d)", []); 4041 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b).c(d)", []);
4042 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.target); 4042 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.target);
4043 expect(section.period, isNotNull); 4043 expect(section.period, isNotNull);
4044 expect(section.methodName, isNotNull); 4044 expect(section.methodName, isNotNull);
4045 expect(section.argumentList, isNotNull); 4045 expect(section.argumentList, isNotNull);
4046 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4046 expect(section.argumentList.arguments, hasLength(1));
4047 } 4047 }
4048 4048
4049 void test_parseCascadeSection_p() { 4049 void test_parseCascadeSection_p() {
4050 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a", []); 4050 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a", []);
4051 expect(section.target, isNull); 4051 expect(section.target, isNull);
4052 expect(section.operator, isNotNull); 4052 expect(section.operator, isNotNull);
4053 expect(section.propertyName, isNotNull); 4053 expect(section.propertyName, isNotNull);
4054 } 4054 }
4055 4055
4056 void test_parseCascadeSection_p_assign() { 4056 void test_parseCascadeSection_p_assign() {
(...skipping 18 matching lines...) Expand all
4075 expect(section.operator, isNotNull); 4075 expect(section.operator, isNotNull);
4076 expect(section.propertyName, isNotNull); 4076 expect(section.propertyName, isNotNull);
4077 } 4077 }
4078 4078
4079 void test_parseCascadeSection_pa() { 4079 void test_parseCascadeSection_pa() {
4080 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b)", []); 4080 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b)", []);
4081 expect(section.target, isNull); 4081 expect(section.target, isNull);
4082 expect(section.period, isNotNull); 4082 expect(section.period, isNotNull);
4083 expect(section.methodName, isNotNull); 4083 expect(section.methodName, isNotNull);
4084 expect(section.argumentList, isNotNull); 4084 expect(section.argumentList, isNotNull);
4085 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4085 expect(section.argumentList.arguments, hasLength(1));
4086 } 4086 }
4087 4087
4088 void test_parseCascadeSection_paa() { 4088 void test_parseCascadeSection_paa() {
4089 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c)", []); 4089 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c)", []);
4090 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function); 4090 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function);
4091 expect(section.argumentList, isNotNull); 4091 expect(section.argumentList, isNotNull);
4092 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4092 expect(section.argumentList.arguments, hasLength(1));
4093 } 4093 }
4094 4094
4095 void test_parseCascadeSection_paapaa() { 4095 void test_parseCascadeSection_paapaa() {
4096 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c).d(e)(f)", []); 4096 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c).d(e)(f)", []);
4097 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function); 4097 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function);
4098 expect(section.argumentList, isNotNull); 4098 expect(section.argumentList, isNotNull);
4099 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4099 expect(section.argumentList.arguments, hasLength(1));
4100 } 4100 }
4101 4101
4102 void test_parseCascadeSection_pap() { 4102 void test_parseCascadeSection_pap() {
4103 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a(b ).c", []); 4103 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a(b ).c", []);
4104 expect(section.target, isNotNull); 4104 expect(section.target, isNotNull);
4105 expect(section.operator, isNotNull); 4105 expect(section.operator, isNotNull);
4106 expect(section.propertyName, isNotNull); 4106 expect(section.propertyName, isNotNull);
4107 } 4107 }
4108 4108
4109 void test_parseClassDeclaration_abstract() { 4109 void test_parseClassDeclaration_abstract() {
4110 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [ 4110 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [
4111 emptyCommentAndMetadata(), 4111 emptyCommentAndMetadata(),
4112 TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)], "class A {}"); 4112 TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)], "class A {}");
4113 expect(declaration.documentationComment, isNull); 4113 expect(declaration.documentationComment, isNull);
4114 expect(declaration.abstractKeyword, isNotNull); 4114 expect(declaration.abstractKeyword, isNotNull);
4115 expect(declaration.extendsClause, isNull); 4115 expect(declaration.extendsClause, isNull);
4116 expect(declaration.implementsClause, isNull); 4116 expect(declaration.implementsClause, isNull);
4117 expect(declaration.classKeyword, isNotNull); 4117 expect(declaration.classKeyword, isNotNull);
4118 expect(declaration.leftBracket, isNotNull); 4118 expect(declaration.leftBracket, isNotNull);
4119 expect(declaration.name, isNotNull); 4119 expect(declaration.name, isNotNull);
4120 EngineTestCase.assertSizeOfList(0, declaration.members); 4120 expect(declaration.members, hasLength(0));
4121 expect(declaration.rightBracket, isNotNull); 4121 expect(declaration.rightBracket, isNotNull);
4122 expect(declaration.typeParameters, isNull); 4122 expect(declaration.typeParameters, isNull);
4123 } 4123 }
4124 4124
4125 void test_parseClassDeclaration_empty() { 4125 void test_parseClassDeclaration_empty() {
4126 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}"); 4126 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}");
4127 expect(declaration.documentationComment, isNull); 4127 expect(declaration.documentationComment, isNull);
4128 expect(declaration.abstractKeyword, isNull); 4128 expect(declaration.abstractKeyword, isNull);
4129 expect(declaration.extendsClause, isNull); 4129 expect(declaration.extendsClause, isNull);
4130 expect(declaration.implementsClause, isNull); 4130 expect(declaration.implementsClause, isNull);
4131 expect(declaration.classKeyword, isNotNull); 4131 expect(declaration.classKeyword, isNotNull);
4132 expect(declaration.leftBracket, isNotNull); 4132 expect(declaration.leftBracket, isNotNull);
4133 expect(declaration.name, isNotNull); 4133 expect(declaration.name, isNotNull);
4134 EngineTestCase.assertSizeOfList(0, declaration.members); 4134 expect(declaration.members, hasLength(0));
4135 expect(declaration.rightBracket, isNotNull); 4135 expect(declaration.rightBracket, isNotNull);
4136 expect(declaration.typeParameters, isNull); 4136 expect(declaration.typeParameters, isNull);
4137 } 4137 }
4138 4138
4139 void test_parseClassDeclaration_extends() { 4139 void test_parseClassDeclaration_extends() {
4140 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B {}"); 4140 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B {}");
4141 expect(declaration.documentationComment, isNull); 4141 expect(declaration.documentationComment, isNull);
4142 expect(declaration.abstractKeyword, isNull); 4142 expect(declaration.abstractKeyword, isNull);
4143 expect(declaration.extendsClause, isNotNull); 4143 expect(declaration.extendsClause, isNotNull);
4144 expect(declaration.implementsClause, isNull); 4144 expect(declaration.implementsClause, isNull);
4145 expect(declaration.classKeyword, isNotNull); 4145 expect(declaration.classKeyword, isNotNull);
4146 expect(declaration.leftBracket, isNotNull); 4146 expect(declaration.leftBracket, isNotNull);
4147 expect(declaration.name, isNotNull); 4147 expect(declaration.name, isNotNull);
4148 EngineTestCase.assertSizeOfList(0, declaration.members); 4148 expect(declaration.members, hasLength(0));
4149 expect(declaration.rightBracket, isNotNull); 4149 expect(declaration.rightBracket, isNotNull);
4150 expect(declaration.typeParameters, isNull); 4150 expect(declaration.typeParameters, isNull);
4151 } 4151 }
4152 4152
4153 void test_parseClassDeclaration_extendsAndImplements() { 4153 void test_parseClassDeclaration_extendsAndImplements() {
4154 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B implements C {}" ); 4154 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B implements C {}" );
4155 expect(declaration.documentationComment, isNull); 4155 expect(declaration.documentationComment, isNull);
4156 expect(declaration.abstractKeyword, isNull); 4156 expect(declaration.abstractKeyword, isNull);
4157 expect(declaration.extendsClause, isNotNull); 4157 expect(declaration.extendsClause, isNotNull);
4158 expect(declaration.implementsClause, isNotNull); 4158 expect(declaration.implementsClause, isNotNull);
4159 expect(declaration.classKeyword, isNotNull); 4159 expect(declaration.classKeyword, isNotNull);
4160 expect(declaration.leftBracket, isNotNull); 4160 expect(declaration.leftBracket, isNotNull);
4161 expect(declaration.name, isNotNull); 4161 expect(declaration.name, isNotNull);
4162 EngineTestCase.assertSizeOfList(0, declaration.members); 4162 expect(declaration.members, hasLength(0));
4163 expect(declaration.rightBracket, isNotNull); 4163 expect(declaration.rightBracket, isNotNull);
4164 expect(declaration.typeParameters, isNull); 4164 expect(declaration.typeParameters, isNull);
4165 } 4165 }
4166 4166
4167 void test_parseClassDeclaration_extendsAndWith() { 4167 void test_parseClassDeclaration_extendsAndWith() {
4168 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C {}"); 4168 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C {}");
4169 expect(declaration.documentationComment, isNull); 4169 expect(declaration.documentationComment, isNull);
4170 expect(declaration.abstractKeyword, isNull); 4170 expect(declaration.abstractKeyword, isNull);
4171 expect(declaration.classKeyword, isNotNull); 4171 expect(declaration.classKeyword, isNotNull);
4172 expect(declaration.name, isNotNull); 4172 expect(declaration.name, isNotNull);
4173 expect(declaration.typeParameters, isNull); 4173 expect(declaration.typeParameters, isNull);
4174 expect(declaration.extendsClause, isNotNull); 4174 expect(declaration.extendsClause, isNotNull);
4175 expect(declaration.withClause, isNotNull); 4175 expect(declaration.withClause, isNotNull);
4176 expect(declaration.implementsClause, isNull); 4176 expect(declaration.implementsClause, isNull);
4177 expect(declaration.leftBracket, isNotNull); 4177 expect(declaration.leftBracket, isNotNull);
4178 EngineTestCase.assertSizeOfList(0, declaration.members); 4178 expect(declaration.members, hasLength(0));
4179 expect(declaration.rightBracket, isNotNull); 4179 expect(declaration.rightBracket, isNotNull);
4180 } 4180 }
4181 4181
4182 void test_parseClassDeclaration_extendsAndWithAndImplements() { 4182 void test_parseClassDeclaration_extendsAndWithAndImplements() {
4183 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C implement s D {}"); 4183 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C implement s D {}");
4184 expect(declaration.documentationComment, isNull); 4184 expect(declaration.documentationComment, isNull);
4185 expect(declaration.abstractKeyword, isNull); 4185 expect(declaration.abstractKeyword, isNull);
4186 expect(declaration.classKeyword, isNotNull); 4186 expect(declaration.classKeyword, isNotNull);
4187 expect(declaration.name, isNotNull); 4187 expect(declaration.name, isNotNull);
4188 expect(declaration.typeParameters, isNull); 4188 expect(declaration.typeParameters, isNull);
4189 expect(declaration.extendsClause, isNotNull); 4189 expect(declaration.extendsClause, isNotNull);
4190 expect(declaration.withClause, isNotNull); 4190 expect(declaration.withClause, isNotNull);
4191 expect(declaration.implementsClause, isNotNull); 4191 expect(declaration.implementsClause, isNotNull);
4192 expect(declaration.leftBracket, isNotNull); 4192 expect(declaration.leftBracket, isNotNull);
4193 EngineTestCase.assertSizeOfList(0, declaration.members); 4193 expect(declaration.members, hasLength(0));
4194 expect(declaration.rightBracket, isNotNull); 4194 expect(declaration.rightBracket, isNotNull);
4195 } 4195 }
4196 4196
4197 void test_parseClassDeclaration_implements() { 4197 void test_parseClassDeclaration_implements() {
4198 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A implements C {}"); 4198 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A implements C {}");
4199 expect(declaration.documentationComment, isNull); 4199 expect(declaration.documentationComment, isNull);
4200 expect(declaration.abstractKeyword, isNull); 4200 expect(declaration.abstractKeyword, isNull);
4201 expect(declaration.extendsClause, isNull); 4201 expect(declaration.extendsClause, isNull);
4202 expect(declaration.implementsClause, isNotNull); 4202 expect(declaration.implementsClause, isNotNull);
4203 expect(declaration.classKeyword, isNotNull); 4203 expect(declaration.classKeyword, isNotNull);
4204 expect(declaration.leftBracket, isNotNull); 4204 expect(declaration.leftBracket, isNotNull);
4205 expect(declaration.name, isNotNull); 4205 expect(declaration.name, isNotNull);
4206 EngineTestCase.assertSizeOfList(0, declaration.members); 4206 expect(declaration.members, hasLength(0));
4207 expect(declaration.rightBracket, isNotNull); 4207 expect(declaration.rightBracket, isNotNull);
4208 expect(declaration.typeParameters, isNull); 4208 expect(declaration.typeParameters, isNull);
4209 } 4209 }
4210 4210
4211 void test_parseClassDeclaration_native() { 4211 void test_parseClassDeclaration_native() {
4212 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}"); 4212 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}");
4213 NativeClause nativeClause = declaration.nativeClause; 4213 NativeClause nativeClause = declaration.nativeClause;
4214 expect(nativeClause, isNotNull); 4214 expect(nativeClause, isNotNull);
4215 expect(nativeClause.keyword, isNotNull); 4215 expect(nativeClause.keyword, isNotNull);
4216 expect(nativeClause.name.stringValue, "nativeValue"); 4216 expect(nativeClause.name.stringValue, "nativeValue");
4217 expect(nativeClause.beginToken, same(nativeClause.keyword)); 4217 expect(nativeClause.beginToken, same(nativeClause.keyword));
4218 expect(nativeClause.endToken, same(nativeClause.name.endToken)); 4218 expect(nativeClause.endToken, same(nativeClause.name.endToken));
4219 } 4219 }
4220 4220
4221 void test_parseClassDeclaration_nonEmpty() { 4221 void test_parseClassDeclaration_nonEmpty() {
4222 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}"); 4222 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}");
4223 expect(declaration.documentationComment, isNull); 4223 expect(declaration.documentationComment, isNull);
4224 expect(declaration.abstractKeyword, isNull); 4224 expect(declaration.abstractKeyword, isNull);
4225 expect(declaration.extendsClause, isNull); 4225 expect(declaration.extendsClause, isNull);
4226 expect(declaration.implementsClause, isNull); 4226 expect(declaration.implementsClause, isNull);
4227 expect(declaration.classKeyword, isNotNull); 4227 expect(declaration.classKeyword, isNotNull);
4228 expect(declaration.leftBracket, isNotNull); 4228 expect(declaration.leftBracket, isNotNull);
4229 expect(declaration.name, isNotNull); 4229 expect(declaration.name, isNotNull);
4230 EngineTestCase.assertSizeOfList(1, declaration.members); 4230 expect(declaration.members, hasLength(1));
4231 expect(declaration.rightBracket, isNotNull); 4231 expect(declaration.rightBracket, isNotNull);
4232 expect(declaration.typeParameters, isNull); 4232 expect(declaration.typeParameters, isNull);
4233 } 4233 }
4234 4234
4235 void test_parseClassDeclaration_typeAlias_implementsC() { 4235 void test_parseClassDeclaration_typeAlias_implementsC() {
4236 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B implements C;" ); 4236 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B implements C;" );
4237 expect(typeAlias.keyword, isNotNull); 4237 expect(typeAlias.keyword, isNotNull);
4238 expect(typeAlias.name, isNotNull); 4238 expect(typeAlias.name, isNotNull);
4239 expect(typeAlias.typeParameters, isNull); 4239 expect(typeAlias.typeParameters, isNull);
4240 expect(typeAlias.withClause, isNotNull); 4240 expect(typeAlias.withClause, isNotNull);
(...skipping 17 matching lines...) Expand all
4258 4258
4259 void test_parseClassDeclaration_typeParameters() { 4259 void test_parseClassDeclaration_typeParameters() {
4260 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}"); 4260 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}");
4261 expect(declaration.documentationComment, isNull); 4261 expect(declaration.documentationComment, isNull);
4262 expect(declaration.abstractKeyword, isNull); 4262 expect(declaration.abstractKeyword, isNull);
4263 expect(declaration.extendsClause, isNull); 4263 expect(declaration.extendsClause, isNull);
4264 expect(declaration.implementsClause, isNull); 4264 expect(declaration.implementsClause, isNull);
4265 expect(declaration.classKeyword, isNotNull); 4265 expect(declaration.classKeyword, isNotNull);
4266 expect(declaration.leftBracket, isNotNull); 4266 expect(declaration.leftBracket, isNotNull);
4267 expect(declaration.name, isNotNull); 4267 expect(declaration.name, isNotNull);
4268 EngineTestCase.assertSizeOfList(0, declaration.members); 4268 expect(declaration.members, hasLength(0));
4269 expect(declaration.rightBracket, isNotNull); 4269 expect(declaration.rightBracket, isNotNull);
4270 expect(declaration.typeParameters, isNotNull); 4270 expect(declaration.typeParameters, isNotNull);
4271 EngineTestCase.assertSizeOfList(1, declaration.typeParameters.typeParameters ); 4271 expect(declaration.typeParameters.typeParameters, hasLength(1));
4272 } 4272 }
4273 4273
4274 void test_parseClassMember_constructor_withInitializers() { 4274 void test_parseClassMember_constructor_withInitializers() {
4275 // TODO(brianwilkerson) Test other kinds of class members: fields, getters a nd setters. 4275 // TODO(brianwilkerson) Test other kinds of class members: fields, getters a nd setters.
4276 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}"); 4276 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}");
4277 expect(constructor.body, isNotNull); 4277 expect(constructor.body, isNotNull);
4278 expect(constructor.separator, isNotNull); 4278 expect(constructor.separator, isNotNull);
4279 expect(constructor.externalKeyword, isNull); 4279 expect(constructor.externalKeyword, isNull);
4280 expect(constructor.constKeyword, isNull); 4280 expect(constructor.constKeyword, isNull);
4281 expect(constructor.factoryKeyword, isNull); 4281 expect(constructor.factoryKeyword, isNull);
4282 expect(constructor.name, isNull); 4282 expect(constructor.name, isNull);
4283 expect(constructor.parameters, isNotNull); 4283 expect(constructor.parameters, isNotNull);
4284 expect(constructor.period, isNull); 4284 expect(constructor.period, isNull);
4285 expect(constructor.returnType, isNotNull); 4285 expect(constructor.returnType, isNotNull);
4286 EngineTestCase.assertSizeOfList(1, constructor.initializers); 4286 expect(constructor.initializers, hasLength(1));
4287 } 4287 }
4288 4288
4289 void test_parseClassMember_field_instance_prefixedType() { 4289 void test_parseClassMember_field_instance_prefixedType() {
4290 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;"); 4290 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;");
4291 expect(field.documentationComment, isNull); 4291 expect(field.documentationComment, isNull);
4292 EngineTestCase.assertSizeOfList(0, field.metadata); 4292 expect(field.metadata, hasLength(0));
4293 expect(field.staticKeyword, isNull); 4293 expect(field.staticKeyword, isNull);
4294 VariableDeclarationList list = field.fields; 4294 VariableDeclarationList list = field.fields;
4295 expect(list, isNotNull); 4295 expect(list, isNotNull);
4296 NodeList<VariableDeclaration> variables = list.variables; 4296 NodeList<VariableDeclaration> variables = list.variables;
4297 EngineTestCase.assertSizeOfList(1, variables); 4297 expect(variables, hasLength(1));
4298 VariableDeclaration variable = variables[0]; 4298 VariableDeclaration variable = variables[0];
4299 expect(variable.name, isNotNull); 4299 expect(variable.name, isNotNull);
4300 } 4300 }
4301 4301
4302 void test_parseClassMember_field_namedGet() { 4302 void test_parseClassMember_field_namedGet() {
4303 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;"); 4303 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;");
4304 expect(field.documentationComment, isNull); 4304 expect(field.documentationComment, isNull);
4305 EngineTestCase.assertSizeOfList(0, field.metadata); 4305 expect(field.metadata, hasLength(0));
4306 expect(field.staticKeyword, isNull); 4306 expect(field.staticKeyword, isNull);
4307 VariableDeclarationList list = field.fields; 4307 VariableDeclarationList list = field.fields;
4308 expect(list, isNotNull); 4308 expect(list, isNotNull);
4309 NodeList<VariableDeclaration> variables = list.variables; 4309 NodeList<VariableDeclaration> variables = list.variables;
4310 EngineTestCase.assertSizeOfList(1, variables); 4310 expect(variables, hasLength(1));
4311 VariableDeclaration variable = variables[0]; 4311 VariableDeclaration variable = variables[0];
4312 expect(variable.name, isNotNull); 4312 expect(variable.name, isNotNull);
4313 } 4313 }
4314 4314
4315 void test_parseClassMember_field_namedOperator() { 4315 void test_parseClassMember_field_namedOperator() {
4316 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;"); 4316 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;");
4317 expect(field.documentationComment, isNull); 4317 expect(field.documentationComment, isNull);
4318 EngineTestCase.assertSizeOfList(0, field.metadata); 4318 expect(field.metadata, hasLength(0));
4319 expect(field.staticKeyword, isNull); 4319 expect(field.staticKeyword, isNull);
4320 VariableDeclarationList list = field.fields; 4320 VariableDeclarationList list = field.fields;
4321 expect(list, isNotNull); 4321 expect(list, isNotNull);
4322 NodeList<VariableDeclaration> variables = list.variables; 4322 NodeList<VariableDeclaration> variables = list.variables;
4323 EngineTestCase.assertSizeOfList(1, variables); 4323 expect(variables, hasLength(1));
4324 VariableDeclaration variable = variables[0]; 4324 VariableDeclaration variable = variables[0];
4325 expect(variable.name, isNotNull); 4325 expect(variable.name, isNotNull);
4326 } 4326 }
4327 4327
4328 void test_parseClassMember_field_namedOperator_withAssignment() { 4328 void test_parseClassMember_field_namedOperator_withAssignment() {
4329 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator = (5);"); 4329 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator = (5);");
4330 expect(field.documentationComment, isNull); 4330 expect(field.documentationComment, isNull);
4331 EngineTestCase.assertSizeOfList(0, field.metadata); 4331 expect(field.metadata, hasLength(0));
4332 expect(field.staticKeyword, isNull); 4332 expect(field.staticKeyword, isNull);
4333 VariableDeclarationList list = field.fields; 4333 VariableDeclarationList list = field.fields;
4334 expect(list, isNotNull); 4334 expect(list, isNotNull);
4335 NodeList<VariableDeclaration> variables = list.variables; 4335 NodeList<VariableDeclaration> variables = list.variables;
4336 EngineTestCase.assertSizeOfList(1, variables); 4336 expect(variables, hasLength(1));
4337 VariableDeclaration variable = variables[0]; 4337 VariableDeclaration variable = variables[0];
4338 expect(variable.name, isNotNull); 4338 expect(variable.name, isNotNull);
4339 expect(variable.initializer, isNotNull); 4339 expect(variable.initializer, isNotNull);
4340 } 4340 }
4341 4341
4342 void test_parseClassMember_field_namedSet() { 4342 void test_parseClassMember_field_namedSet() {
4343 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;"); 4343 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;");
4344 expect(field.documentationComment, isNull); 4344 expect(field.documentationComment, isNull);
4345 EngineTestCase.assertSizeOfList(0, field.metadata); 4345 expect(field.metadata, hasLength(0));
4346 expect(field.staticKeyword, isNull); 4346 expect(field.staticKeyword, isNull);
4347 VariableDeclarationList list = field.fields; 4347 VariableDeclarationList list = field.fields;
4348 expect(list, isNotNull); 4348 expect(list, isNotNull);
4349 NodeList<VariableDeclaration> variables = list.variables; 4349 NodeList<VariableDeclaration> variables = list.variables;
4350 EngineTestCase.assertSizeOfList(1, variables); 4350 expect(variables, hasLength(1));
4351 VariableDeclaration variable = variables[0]; 4351 VariableDeclaration variable = variables[0];
4352 expect(variable.name, isNotNull); 4352 expect(variable.name, isNotNull);
4353 } 4353 }
4354 4354
4355 void test_parseClassMember_getter_void() { 4355 void test_parseClassMember_getter_void() {
4356 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}"); 4356 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}");
4357 expect(method.documentationComment, isNull); 4357 expect(method.documentationComment, isNull);
4358 expect(method.externalKeyword, isNull); 4358 expect(method.externalKeyword, isNull);
4359 expect(method.modifierKeyword, isNull); 4359 expect(method.modifierKeyword, isNull);
4360 expect(method.propertyKeyword, isNotNull); 4360 expect(method.propertyKeyword, isNotNull);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4549 void test_parseClassMember_redirectingFactory_const() { 4549 void test_parseClassMember_redirectingFactory_const() {
4550 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;"); 4550 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;");
4551 expect(constructor.externalKeyword, isNull); 4551 expect(constructor.externalKeyword, isNull);
4552 expect(constructor.constKeyword, isNotNull); 4552 expect(constructor.constKeyword, isNotNull);
4553 expect(constructor.factoryKeyword, isNotNull); 4553 expect(constructor.factoryKeyword, isNotNull);
4554 expect(constructor.returnType, isNotNull); 4554 expect(constructor.returnType, isNotNull);
4555 expect(constructor.period, isNull); 4555 expect(constructor.period, isNull);
4556 expect(constructor.name, isNull); 4556 expect(constructor.name, isNull);
4557 expect(constructor.parameters, isNotNull); 4557 expect(constructor.parameters, isNotNull);
4558 expect(constructor.separator, isNotNull); 4558 expect(constructor.separator, isNotNull);
4559 EngineTestCase.assertSizeOfList(0, constructor.initializers); 4559 expect(constructor.initializers, hasLength(0));
4560 expect(constructor.redirectedConstructor, isNotNull); 4560 expect(constructor.redirectedConstructor, isNotNull);
4561 expect(constructor.body, isNotNull); 4561 expect(constructor.body, isNotNull);
4562 } 4562 }
4563 4563
4564 void test_parseClassMember_redirectingFactory_nonConst() { 4564 void test_parseClassMember_redirectingFactory_nonConst() {
4565 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;"); 4565 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;");
4566 expect(constructor.externalKeyword, isNull); 4566 expect(constructor.externalKeyword, isNull);
4567 expect(constructor.constKeyword, isNull); 4567 expect(constructor.constKeyword, isNull);
4568 expect(constructor.factoryKeyword, isNotNull); 4568 expect(constructor.factoryKeyword, isNotNull);
4569 expect(constructor.returnType, isNotNull); 4569 expect(constructor.returnType, isNotNull);
4570 expect(constructor.period, isNull); 4570 expect(constructor.period, isNull);
4571 expect(constructor.name, isNull); 4571 expect(constructor.name, isNull);
4572 expect(constructor.parameters, isNotNull); 4572 expect(constructor.parameters, isNotNull);
4573 expect(constructor.separator, isNotNull); 4573 expect(constructor.separator, isNotNull);
4574 EngineTestCase.assertSizeOfList(0, constructor.initializers); 4574 expect(constructor.initializers, hasLength(0));
4575 expect(constructor.redirectedConstructor, isNotNull); 4575 expect(constructor.redirectedConstructor, isNotNull);
4576 expect(constructor.body, isNotNull); 4576 expect(constructor.body, isNotNull);
4577 } 4577 }
4578 4578
4579 void test_parseClassTypeAlias_abstract() { 4579 void test_parseClassTypeAlias_abstract() {
4580 Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS); 4580 Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
4581 Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT); 4581 Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT);
4582 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), abstractToken, classToken], "A = B with C;" ); 4582 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), abstractToken, classToken], "A = B with C;" );
4583 expect(classTypeAlias.keyword, isNotNull); 4583 expect(classTypeAlias.keyword, isNotNull);
4584 expect(classTypeAlias.name.name, "A"); 4584 expect(classTypeAlias.name.name, "A");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 expect(classTypeAlias.equals, isNotNull); 4624 expect(classTypeAlias.equals, isNotNull);
4625 expect(classTypeAlias.abstractKeyword, isNull); 4625 expect(classTypeAlias.abstractKeyword, isNull);
4626 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B"); 4626 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
4627 expect(classTypeAlias.withClause, isNotNull); 4627 expect(classTypeAlias.withClause, isNotNull);
4628 expect(classTypeAlias.implementsClause, isNotNull); 4628 expect(classTypeAlias.implementsClause, isNotNull);
4629 expect(classTypeAlias.semicolon, isNotNull); 4629 expect(classTypeAlias.semicolon, isNotNull);
4630 } 4630 }
4631 4631
4632 void test_parseCombinators_h() { 4632 void test_parseCombinators_h() {
4633 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a;", []); 4633 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a;", []);
4634 EngineTestCase.assertSizeOfList(1, combinators); 4634 expect(combinators, hasLength(1));
4635 HideCombinator combinator = combinators[0] as HideCombinator; 4635 HideCombinator combinator = combinators[0] as HideCombinator;
4636 expect(combinator, isNotNull); 4636 expect(combinator, isNotNull);
4637 expect(combinator.keyword, isNotNull); 4637 expect(combinator.keyword, isNotNull);
4638 EngineTestCase.assertSizeOfList(1, combinator.hiddenNames); 4638 expect(combinator.hiddenNames, hasLength(1));
4639 } 4639 }
4640 4640
4641 void test_parseCombinators_hs() { 4641 void test_parseCombinators_hs() {
4642 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b;", []); 4642 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b;", []);
4643 EngineTestCase.assertSizeOfList(2, combinators); 4643 expect(combinators, hasLength(2));
4644 HideCombinator hideCombinator = combinators[0] as HideCombinator; 4644 HideCombinator hideCombinator = combinators[0] as HideCombinator;
4645 expect(hideCombinator, isNotNull); 4645 expect(hideCombinator, isNotNull);
4646 expect(hideCombinator.keyword, isNotNull); 4646 expect(hideCombinator.keyword, isNotNull);
4647 EngineTestCase.assertSizeOfList(1, hideCombinator.hiddenNames); 4647 expect(hideCombinator.hiddenNames, hasLength(1));
4648 ShowCombinator showCombinator = combinators[1] as ShowCombinator; 4648 ShowCombinator showCombinator = combinators[1] as ShowCombinator;
4649 expect(showCombinator, isNotNull); 4649 expect(showCombinator, isNotNull);
4650 expect(showCombinator.keyword, isNotNull); 4650 expect(showCombinator.keyword, isNotNull);
4651 EngineTestCase.assertSizeOfList(1, showCombinator.shownNames); 4651 expect(showCombinator.shownNames, hasLength(1));
4652 } 4652 }
4653 4653
4654 void test_parseCombinators_hshs() { 4654 void test_parseCombinators_hshs() {
4655 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b hide c show d;", []); 4655 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b hide c show d;", []);
4656 EngineTestCase.assertSizeOfList(4, combinators); 4656 expect(combinators, hasLength(4));
4657 } 4657 }
4658 4658
4659 void test_parseCombinators_s() { 4659 void test_parseCombinators_s() {
4660 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "sh ow a;", []); 4660 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "sh ow a;", []);
4661 EngineTestCase.assertSizeOfList(1, combinators); 4661 expect(combinators, hasLength(1));
4662 ShowCombinator combinator = combinators[0] as ShowCombinator; 4662 ShowCombinator combinator = combinators[0] as ShowCombinator;
4663 expect(combinator, isNotNull); 4663 expect(combinator, isNotNull);
4664 expect(combinator.keyword, isNotNull); 4664 expect(combinator.keyword, isNotNull);
4665 EngineTestCase.assertSizeOfList(1, combinator.shownNames); 4665 expect(combinator.shownNames, hasLength(1));
4666 } 4666 }
4667 4667
4668 void test_parseCommentAndMetadata_c() { 4668 void test_parseCommentAndMetadata_c() {
4669 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ void", []); 4669 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ void", []);
4670 expect(commentAndMetadata.comment, isNotNull); 4670 expect(commentAndMetadata.comment, isNotNull);
4671 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4671 expect(commentAndMetadata.metadata, hasLength(0));
4672 } 4672 }
4673 4673
4674 void test_parseCommentAndMetadata_cmc() { 4674 void test_parseCommentAndMetadata_cmc() {
4675 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []); 4675 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []);
4676 expect(commentAndMetadata.comment, isNotNull); 4676 expect(commentAndMetadata.comment, isNotNull);
4677 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata); 4677 expect(commentAndMetadata.metadata, hasLength(1));
4678 } 4678 }
4679 4679
4680 void test_parseCommentAndMetadata_cmcm() { 4680 void test_parseCommentAndMetadata_cmcm() {
4681 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []); 4681 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []);
4682 expect(commentAndMetadata.comment, isNotNull); 4682 expect(commentAndMetadata.comment, isNotNull);
4683 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4683 expect(commentAndMetadata.metadata, hasLength(2));
4684 } 4684 }
4685 4685
4686 void test_parseCommentAndMetadata_cmm() { 4686 void test_parseCommentAndMetadata_cmm() {
4687 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A @B void", []); 4687 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A @B void", []);
4688 expect(commentAndMetadata.comment, isNotNull); 4688 expect(commentAndMetadata.comment, isNotNull);
4689 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4689 expect(commentAndMetadata.metadata, hasLength(2));
4690 } 4690 }
4691 4691
4692 void test_parseCommentAndMetadata_m() { 4692 void test_parseCommentAndMetadata_m() {
4693 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A void", []); 4693 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A void", []);
4694 expect(commentAndMetadata.comment, isNull); 4694 expect(commentAndMetadata.comment, isNull);
4695 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata); 4695 expect(commentAndMetadata.metadata, hasLength(1));
4696 } 4696 }
4697 4697
4698 void test_parseCommentAndMetadata_mcm() { 4698 void test_parseCommentAndMetadata_mcm() {
4699 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B void", []); 4699 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B void", []);
4700 expect(commentAndMetadata.comment, isNotNull); 4700 expect(commentAndMetadata.comment, isNotNull);
4701 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4701 expect(commentAndMetadata.metadata, hasLength(2));
4702 } 4702 }
4703 4703
4704 void test_parseCommentAndMetadata_mcmc() { 4704 void test_parseCommentAndMetadata_mcmc() {
4705 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []); 4705 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []);
4706 expect(commentAndMetadata.comment, isNotNull); 4706 expect(commentAndMetadata.comment, isNotNull);
4707 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4707 expect(commentAndMetadata.metadata, hasLength(2));
4708 } 4708 }
4709 4709
4710 void test_parseCommentAndMetadata_mm() { 4710 void test_parseCommentAndMetadata_mm() {
4711 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A @B(x) void", []); 4711 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A @B(x) void", []);
4712 expect(commentAndMetadata.comment, isNull); 4712 expect(commentAndMetadata.comment, isNull);
4713 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4713 expect(commentAndMetadata.metadata, hasLength(2));
4714 } 4714 }
4715 4715
4716 void test_parseCommentAndMetadata_none() { 4716 void test_parseCommentAndMetadata_none() {
4717 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "void", []); 4717 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "void", []);
4718 expect(commentAndMetadata.comment, isNull); 4718 expect(commentAndMetadata.comment, isNull);
4719 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4719 expect(commentAndMetadata.metadata, hasLength(0));
4720 } 4720 }
4721 4721
4722 void test_parseCommentAndMetadata_singleLine() { 4722 void test_parseCommentAndMetadata_singleLine() {
4723 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", r''' 4723 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", r'''
4724 /// 1 4724 /// 1
4725 /// 2 4725 /// 2
4726 void''', []); 4726 void''', []);
4727 expect(commentAndMetadata.comment, isNotNull); 4727 expect(commentAndMetadata.comment, isNotNull);
4728 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4728 expect(commentAndMetadata.metadata, hasLength(0));
4729 } 4729 }
4730 4730
4731 void test_parseCommentReference_new_prefixed() { 4731 void test_parseCommentReference_new_prefixed() {
4732 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], ""); 4732 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], "");
4733 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier); 4733 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier);
4734 SimpleIdentifier prefix = prefixedIdentifier.prefix; 4734 SimpleIdentifier prefix = prefixedIdentifier.prefix;
4735 expect(prefix.token, isNotNull); 4735 expect(prefix.token, isNotNull);
4736 expect(prefix.name, "a"); 4736 expect(prefix.name, "a");
4737 expect(prefix.offset, 11); 4737 expect(prefix.offset, 11);
4738 expect(prefixedIdentifier.period, isNotNull); 4738 expect(prefixedIdentifier.period, isNotNull);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4778 expect(identifier, isNotNull); 4778 expect(identifier, isNotNull);
4779 expect(identifier.isSynthetic, isTrue); 4779 expect(identifier.isSynthetic, isTrue);
4780 expect(identifier.token, isNotNull); 4780 expect(identifier.token, isNotNull);
4781 expect(identifier.name, ""); 4781 expect(identifier.name, "");
4782 expect(identifier.offset, 5); 4782 expect(identifier.offset, 5);
4783 } 4783 }
4784 4784
4785 void test_parseCommentReferences_multiLine() { 4785 void test_parseCommentReferences_multiLine() {
4786 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)]; 4786 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)];
4787 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4787 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4788 EngineTestCase.assertSizeOfList(2, references); 4788 expect(references, hasLength(2));
4789 CommentReference reference = references[0]; 4789 CommentReference reference = references[0];
4790 expect(reference, isNotNull); 4790 expect(reference, isNotNull);
4791 expect(reference.identifier, isNotNull); 4791 expect(reference.identifier, isNotNull);
4792 expect(reference.offset, 12); 4792 expect(reference.offset, 12);
4793 reference = references[1]; 4793 reference = references[1];
4794 expect(reference, isNotNull); 4794 expect(reference, isNotNull);
4795 expect(reference.identifier, isNotNull); 4795 expect(reference.identifier, isNotNull);
4796 expect(reference.offset, 20); 4796 expect(reference.offset, 20);
4797 } 4797 }
4798 4798
4799 void test_parseCommentReferences_notClosed_noIdentifier() { 4799 void test_parseCommentReferences_notClosed_noIdentifier() {
4800 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)]; 4800 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)];
4801 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4801 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4802 EngineTestCase.assertSizeOfList(1, references); 4802 expect(references, hasLength(1));
4803 CommentReference reference = references[0]; 4803 CommentReference reference = references[0];
4804 expect(reference, isNotNull); 4804 expect(reference, isNotNull);
4805 expect(reference.identifier, isNotNull); 4805 expect(reference.identifier, isNotNull);
4806 expect(reference.identifier.isSynthetic, isTrue); 4806 expect(reference.identifier.isSynthetic, isTrue);
4807 expect(reference.identifier.name, ""); 4807 expect(reference.identifier.name, "");
4808 } 4808 }
4809 4809
4810 void test_parseCommentReferences_notClosed_withIdentifier() { 4810 void test_parseCommentReferences_notClosed_withIdentifier() {
4811 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)]; 4811 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)];
4812 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4812 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4813 EngineTestCase.assertSizeOfList(1, references); 4813 expect(references, hasLength(1));
4814 CommentReference reference = references[0]; 4814 CommentReference reference = references[0];
4815 expect(reference, isNotNull); 4815 expect(reference, isNotNull);
4816 expect(reference.identifier, isNotNull); 4816 expect(reference.identifier, isNotNull);
4817 expect(reference.identifier.isSynthetic, isFalse); 4817 expect(reference.identifier.isSynthetic, isFalse);
4818 expect(reference.identifier.name, "namePrefix"); 4818 expect(reference.identifier.name, "namePrefix");
4819 } 4819 }
4820 4820
4821 void test_parseCommentReferences_singleLine() { 4821 void test_parseCommentReferences_singleLine() {
4822 List<Token> tokens = <Token> [ 4822 List<Token> tokens = <Token> [
4823 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz" , 3), 4823 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz" , 3),
4824 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)]; 4824 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)];
4825 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4825 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4826 EngineTestCase.assertSizeOfList(3, references); 4826 expect(references, hasLength(3));
4827 CommentReference reference = references[0]; 4827 CommentReference reference = references[0];
4828 expect(reference, isNotNull); 4828 expect(reference, isNotNull);
4829 expect(reference.identifier, isNotNull); 4829 expect(reference.identifier, isNotNull);
4830 expect(reference.offset, 12); 4830 expect(reference.offset, 12);
4831 reference = references[1]; 4831 reference = references[1];
4832 expect(reference, isNotNull); 4832 expect(reference, isNotNull);
4833 expect(reference.identifier, isNotNull); 4833 expect(reference.identifier, isNotNull);
4834 expect(reference.offset, 20); 4834 expect(reference.offset, 20);
4835 reference = references[2]; 4835 reference = references[2];
4836 expect(reference, isNotNull); 4836 expect(reference, isNotNull);
4837 expect(reference.identifier, isNotNull); 4837 expect(reference.identifier, isNotNull);
4838 expect(reference.offset, 35); 4838 expect(reference.offset, 35);
4839 } 4839 }
4840 4840
4841 void test_parseCommentReferences_skipCodeBlock_bracketed() { 4841 void test_parseCommentReferences_skipCodeBlock_bracketed() {
4842 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)]; 4842 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)];
4843 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4843 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4844 EngineTestCase.assertSizeOfList(1, references); 4844 expect(references, hasLength(1));
4845 CommentReference reference = references[0]; 4845 CommentReference reference = references[0];
4846 expect(reference, isNotNull); 4846 expect(reference, isNotNull);
4847 expect(reference.identifier, isNotNull); 4847 expect(reference.identifier, isNotNull);
4848 expect(reference.offset, 24); 4848 expect(reference.offset, 24);
4849 } 4849 }
4850 4850
4851 void test_parseCommentReferences_skipCodeBlock_spaces() { 4851 void test_parseCommentReferences_skipCodeBlock_spaces() {
4852 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/**\n * a[i]\n * xxx [i] zzz\n */", 3)]; 4852 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/**\n * a[i]\n * xxx [i] zzz\n */", 3)];
4853 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4853 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4854 EngineTestCase.assertSizeOfList(1, references); 4854 expect(references, hasLength(1));
4855 CommentReference reference = references[0]; 4855 CommentReference reference = references[0];
4856 expect(reference, isNotNull); 4856 expect(reference, isNotNull);
4857 expect(reference.identifier, isNotNull); 4857 expect(reference.identifier, isNotNull);
4858 expect(reference.offset, 27); 4858 expect(reference.offset, 27);
4859 } 4859 }
4860 4860
4861 void test_parseCommentReferences_skipLinkDefinition() { 4861 void test_parseCommentReferences_skipLinkDefinition() {
4862 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a]: http://www.google.com (Google) [b] zzz */", 3)]; 4862 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a]: http://www.google.com (Google) [b] zzz */", 3)];
4863 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4863 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4864 EngineTestCase.assertSizeOfList(1, references); 4864 expect(references, hasLength(1));
4865 CommentReference reference = references[0]; 4865 CommentReference reference = references[0];
4866 expect(reference, isNotNull); 4866 expect(reference, isNotNull);
4867 expect(reference.identifier, isNotNull); 4867 expect(reference.identifier, isNotNull);
4868 expect(reference.offset, 44); 4868 expect(reference.offset, 44);
4869 } 4869 }
4870 4870
4871 void test_parseCommentReferences_skipLinked() { 4871 void test_parseCommentReferences_skipLinked() {
4872 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a](http://www.google.com) [b] zzz */", 3)]; 4872 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a](http://www.google.com) [b] zzz */", 3)];
4873 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4873 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4874 EngineTestCase.assertSizeOfList(1, references); 4874 expect(references, hasLength(1));
4875 CommentReference reference = references[0]; 4875 CommentReference reference = references[0];
4876 expect(reference, isNotNull); 4876 expect(reference, isNotNull);
4877 expect(reference.identifier, isNotNull); 4877 expect(reference.identifier, isNotNull);
4878 expect(reference.offset, 35); 4878 expect(reference.offset, 35);
4879 } 4879 }
4880 4880
4881 void test_parseCommentReferences_skipReferenceLink() { 4881 void test_parseCommentReferences_skipReferenceLink() {
4882 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)]; 4882 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)];
4883 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4883 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4884 EngineTestCase.assertSizeOfList(1, references); 4884 expect(references, hasLength(1));
4885 CommentReference reference = references[0]; 4885 CommentReference reference = references[0];
4886 expect(reference, isNotNull); 4886 expect(reference, isNotNull);
4887 expect(reference.identifier, isNotNull); 4887 expect(reference.identifier, isNotNull);
4888 expect(reference.offset, 15); 4888 expect(reference.offset, 15);
4889 } 4889 }
4890 4890
4891 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { 4891 void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
4892 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "abstra ct<dynamic> _abstract = new abstract.A();", []); 4892 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "abstra ct<dynamic> _abstract = new abstract.A();", []);
4893 expect(unit.scriptTag, isNull); 4893 expect(unit.scriptTag, isNull);
4894 EngineTestCase.assertSizeOfList(0, unit.directives); 4894 expect(unit.directives, hasLength(0));
4895 EngineTestCase.assertSizeOfList(1, unit.declarations); 4895 expect(unit.declarations, hasLength(1));
4896 } 4896 }
4897 4897
4898 void test_parseCompilationUnit_builtIn_asFunctionName() { 4898 void test_parseCompilationUnit_builtIn_asFunctionName() {
4899 ParserTestCase.parse4("parseCompilationUnit", "abstract(x) => 0;", []); 4899 ParserTestCase.parse4("parseCompilationUnit", "abstract(x) => 0;", []);
4900 ParserTestCase.parse4("parseCompilationUnit", "as(x) => 0;", []); 4900 ParserTestCase.parse4("parseCompilationUnit", "as(x) => 0;", []);
4901 ParserTestCase.parse4("parseCompilationUnit", "dynamic(x) => 0;", []); 4901 ParserTestCase.parse4("parseCompilationUnit", "dynamic(x) => 0;", []);
4902 ParserTestCase.parse4("parseCompilationUnit", "export(x) => 0;", []); 4902 ParserTestCase.parse4("parseCompilationUnit", "export(x) => 0;", []);
4903 ParserTestCase.parse4("parseCompilationUnit", "external(x) => 0;", []); 4903 ParserTestCase.parse4("parseCompilationUnit", "external(x) => 0;", []);
4904 ParserTestCase.parse4("parseCompilationUnit", "factory(x) => 0;", []); 4904 ParserTestCase.parse4("parseCompilationUnit", "factory(x) => 0;", []);
4905 ParserTestCase.parse4("parseCompilationUnit", "get(x) => 0;", []); 4905 ParserTestCase.parse4("parseCompilationUnit", "get(x) => 0;", []);
4906 ParserTestCase.parse4("parseCompilationUnit", "implements(x) => 0;", []); 4906 ParserTestCase.parse4("parseCompilationUnit", "implements(x) => 0;", []);
4907 ParserTestCase.parse4("parseCompilationUnit", "import(x) => 0;", []); 4907 ParserTestCase.parse4("parseCompilationUnit", "import(x) => 0;", []);
4908 ParserTestCase.parse4("parseCompilationUnit", "library(x) => 0;", []); 4908 ParserTestCase.parse4("parseCompilationUnit", "library(x) => 0;", []);
4909 ParserTestCase.parse4("parseCompilationUnit", "operator(x) => 0;", []); 4909 ParserTestCase.parse4("parseCompilationUnit", "operator(x) => 0;", []);
4910 ParserTestCase.parse4("parseCompilationUnit", "part(x) => 0;", []); 4910 ParserTestCase.parse4("parseCompilationUnit", "part(x) => 0;", []);
4911 ParserTestCase.parse4("parseCompilationUnit", "set(x) => 0;", []); 4911 ParserTestCase.parse4("parseCompilationUnit", "set(x) => 0;", []);
4912 ParserTestCase.parse4("parseCompilationUnit", "static(x) => 0;", []); 4912 ParserTestCase.parse4("parseCompilationUnit", "static(x) => 0;", []);
4913 ParserTestCase.parse4("parseCompilationUnit", "typedef(x) => 0;", []); 4913 ParserTestCase.parse4("parseCompilationUnit", "typedef(x) => 0;", []);
4914 } 4914 }
4915 4915
4916 void test_parseCompilationUnit_directives_multiple() { 4916 void test_parseCompilationUnit_directives_multiple() {
4917 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;\npart 'a.dart';", []); 4917 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;\npart 'a.dart';", []);
4918 expect(unit.scriptTag, isNull); 4918 expect(unit.scriptTag, isNull);
4919 EngineTestCase.assertSizeOfList(2, unit.directives); 4919 expect(unit.directives, hasLength(2));
4920 EngineTestCase.assertSizeOfList(0, unit.declarations); 4920 expect(unit.declarations, hasLength(0));
4921 } 4921 }
4922 4922
4923 void test_parseCompilationUnit_directives_single() { 4923 void test_parseCompilationUnit_directives_single() {
4924 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;", []); 4924 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;", []);
4925 expect(unit.scriptTag, isNull); 4925 expect(unit.scriptTag, isNull);
4926 EngineTestCase.assertSizeOfList(1, unit.directives); 4926 expect(unit.directives, hasLength(1));
4927 EngineTestCase.assertSizeOfList(0, unit.declarations); 4927 expect(unit.declarations, hasLength(0));
4928 } 4928 }
4929 4929
4930 void test_parseCompilationUnit_empty() { 4930 void test_parseCompilationUnit_empty() {
4931 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "", []) ; 4931 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "", []) ;
4932 expect(unit.scriptTag, isNull); 4932 expect(unit.scriptTag, isNull);
4933 EngineTestCase.assertSizeOfList(0, unit.directives); 4933 expect(unit.directives, hasLength(0));
4934 EngineTestCase.assertSizeOfList(0, unit.declarations); 4934 expect(unit.declarations, hasLength(0));
4935 } 4935 }
4936 4936
4937 void test_parseCompilationUnit_exportAsPrefix() { 4937 void test_parseCompilationUnit_exportAsPrefix() {
4938 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export .A _export = new export.A();", []); 4938 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export .A _export = new export.A();", []);
4939 expect(unit.scriptTag, isNull); 4939 expect(unit.scriptTag, isNull);
4940 EngineTestCase.assertSizeOfList(0, unit.directives); 4940 expect(unit.directives, hasLength(0));
4941 EngineTestCase.assertSizeOfList(1, unit.declarations); 4941 expect(unit.declarations, hasLength(1));
4942 } 4942 }
4943 4943
4944 void test_parseCompilationUnit_exportAsPrefix_parameterized() { 4944 void test_parseCompilationUnit_exportAsPrefix_parameterized() {
4945 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export <dynamic> _export = new export.A();", []); 4945 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export <dynamic> _export = new export.A();", []);
4946 expect(unit.scriptTag, isNull); 4946 expect(unit.scriptTag, isNull);
4947 EngineTestCase.assertSizeOfList(0, unit.directives); 4947 expect(unit.directives, hasLength(0));
4948 EngineTestCase.assertSizeOfList(1, unit.declarations); 4948 expect(unit.declarations, hasLength(1));
4949 } 4949 }
4950 4950
4951 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { 4951 void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
4952 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "operat or<dynamic> _operator = new operator.A();", []); 4952 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "operat or<dynamic> _operator = new operator.A();", []);
4953 expect(unit.scriptTag, isNull); 4953 expect(unit.scriptTag, isNull);
4954 EngineTestCase.assertSizeOfList(0, unit.directives); 4954 expect(unit.directives, hasLength(0));
4955 EngineTestCase.assertSizeOfList(1, unit.declarations); 4955 expect(unit.declarations, hasLength(1));
4956 } 4956 }
4957 4957
4958 void test_parseCompilationUnit_script() { 4958 void test_parseCompilationUnit_script() {
4959 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "#! /bi n/dart", []); 4959 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "#! /bi n/dart", []);
4960 expect(unit.scriptTag, isNotNull); 4960 expect(unit.scriptTag, isNotNull);
4961 EngineTestCase.assertSizeOfList(0, unit.directives); 4961 expect(unit.directives, hasLength(0));
4962 EngineTestCase.assertSizeOfList(0, unit.declarations); 4962 expect(unit.declarations, hasLength(0));
4963 } 4963 }
4964 4964
4965 void test_parseCompilationUnit_skipFunctionBody_withInterpolation() { 4965 void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
4966 ParserTestCase.parseFunctionBodies = false; 4966 ParserTestCase.parseFunctionBodies = false;
4967 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }", []); 4967 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }", []);
4968 expect(unit.scriptTag, isNull); 4968 expect(unit.scriptTag, isNull);
4969 EngineTestCase.assertSizeOfList(1, unit.declarations); 4969 expect(unit.declarations, hasLength(1));
4970 } 4970 }
4971 4971
4972 void test_parseCompilationUnit_topLevelDeclaration() { 4972 void test_parseCompilationUnit_topLevelDeclaration() {
4973 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "class A {}", []); 4973 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "class A {}", []);
4974 expect(unit.scriptTag, isNull); 4974 expect(unit.scriptTag, isNull);
4975 EngineTestCase.assertSizeOfList(0, unit.directives); 4975 expect(unit.directives, hasLength(0));
4976 EngineTestCase.assertSizeOfList(1, unit.declarations); 4976 expect(unit.declarations, hasLength(1));
4977 } 4977 }
4978 4978
4979 void test_parseCompilationUnit_typedefAsPrefix() { 4979 void test_parseCompilationUnit_typedefAsPrefix() {
4980 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "typede f.A _typedef = new typedef.A();", []); 4980 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "typede f.A _typedef = new typedef.A();", []);
4981 expect(unit.scriptTag, isNull); 4981 expect(unit.scriptTag, isNull);
4982 EngineTestCase.assertSizeOfList(0, unit.directives); 4982 expect(unit.directives, hasLength(0));
4983 EngineTestCase.assertSizeOfList(1, unit.declarations); 4983 expect(unit.declarations, hasLength(1));
4984 } 4984 }
4985 4985
4986 void test_parseCompilationUnitMember_abstractAsPrefix() { 4986 void test_parseCompilationUnitMember_abstractAsPrefix() {
4987 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "abstract.A _abstract = n ew abstract.A();"); 4987 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "abstract.A _abstract = n ew abstract.A();");
4988 expect(declaration.semicolon, isNotNull); 4988 expect(declaration.semicolon, isNotNull);
4989 expect(declaration.variables, isNotNull); 4989 expect(declaration.variables, isNotNull);
4990 } 4990 }
4991 4991
4992 void test_parseCompilationUnitMember_class() { 4992 void test_parseCompilationUnitMember_class() {
4993 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}"); 4993 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}");
4994 expect(declaration.name.name, "A"); 4994 expect(declaration.name.name, "A");
4995 EngineTestCase.assertSizeOfList(0, declaration.members); 4995 expect(declaration.members, hasLength(0));
4996 } 4996 }
4997 4997
4998 void test_parseCompilationUnitMember_classTypeAlias() { 4998 void test_parseCompilationUnitMember_classTypeAlias() {
4999 ClassTypeAlias alias = ParserTestCase.parse("parseCompilationUnitMember", <O bject> [emptyCommentAndMetadata()], "abstract class A = B with C;"); 4999 ClassTypeAlias alias = ParserTestCase.parse("parseCompilationUnitMember", <O bject> [emptyCommentAndMetadata()], "abstract class A = B with C;");
5000 expect(alias.name.name, "A"); 5000 expect(alias.name.name, "A");
5001 expect(alias.abstractKeyword, isNotNull); 5001 expect(alias.abstractKeyword, isNotNull);
5002 } 5002 }
5003 5003
5004 void test_parseCompilationUnitMember_constVariable() { 5004 void test_parseCompilationUnitMember_constVariable() {
5005 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "const int x = 0;"); 5005 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "const int x = 0;");
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5107 expect(typeAlias.superclass.name.name, "S"); 5107 expect(typeAlias.superclass.name.name, "S");
5108 expect(typeAlias.withClause, isNotNull); 5108 expect(typeAlias.withClause, isNotNull);
5109 expect(typeAlias.implementsClause, isNull); 5109 expect(typeAlias.implementsClause, isNull);
5110 expect(typeAlias.semicolon, isNotNull); 5110 expect(typeAlias.semicolon, isNotNull);
5111 } 5111 }
5112 5112
5113 void test_parseCompilationUnitMember_typeAlias_generic() { 5113 void test_parseCompilationUnitMember_typeAlias_generic() {
5114 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C<E> = S<E> with M<E> implements I<E>;"); 5114 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C<E> = S<E> with M<E> implements I<E>;");
5115 expect(typeAlias.keyword, isNotNull); 5115 expect(typeAlias.keyword, isNotNull);
5116 expect(typeAlias.name.name, "C"); 5116 expect(typeAlias.name.name, "C");
5117 EngineTestCase.assertSizeOfList(1, typeAlias.typeParameters.typeParameters); 5117 expect(typeAlias.typeParameters.typeParameters, hasLength(1));
5118 expect(typeAlias.equals, isNotNull); 5118 expect(typeAlias.equals, isNotNull);
5119 expect(typeAlias.abstractKeyword, isNull); 5119 expect(typeAlias.abstractKeyword, isNull);
5120 expect(typeAlias.superclass.name.name, "S"); 5120 expect(typeAlias.superclass.name.name, "S");
5121 expect(typeAlias.withClause, isNotNull); 5121 expect(typeAlias.withClause, isNotNull);
5122 expect(typeAlias.implementsClause, isNotNull); 5122 expect(typeAlias.implementsClause, isNotNull);
5123 expect(typeAlias.semicolon, isNotNull); 5123 expect(typeAlias.semicolon, isNotNull);
5124 } 5124 }
5125 5125
5126 void test_parseCompilationUnitMember_typeAlias_implements() { 5126 void test_parseCompilationUnitMember_typeAlias_implements() {
5127 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M implements I;"); 5127 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M implements I;");
(...skipping 17 matching lines...) Expand all
5145 expect(typeAlias.abstractKeyword, isNull); 5145 expect(typeAlias.abstractKeyword, isNull);
5146 expect(typeAlias.superclass.name.name, "S"); 5146 expect(typeAlias.superclass.name.name, "S");
5147 expect(typeAlias.withClause, isNotNull); 5147 expect(typeAlias.withClause, isNotNull);
5148 expect(typeAlias.implementsClause, isNull); 5148 expect(typeAlias.implementsClause, isNull);
5149 expect(typeAlias.semicolon, isNotNull); 5149 expect(typeAlias.semicolon, isNotNull);
5150 } 5150 }
5151 5151
5152 void test_parseCompilationUnitMember_typedef() { 5152 void test_parseCompilationUnitMember_typedef() {
5153 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();"); 5153 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();");
5154 expect(typeAlias.name.name, "F"); 5154 expect(typeAlias.name.name, "F");
5155 EngineTestCase.assertSizeOfList(0, typeAlias.parameters.parameters); 5155 expect(typeAlias.parameters.parameters, hasLength(0));
5156 } 5156 }
5157 5157
5158 void test_parseCompilationUnitMember_variable() { 5158 void test_parseCompilationUnitMember_variable() {
5159 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;"); 5159 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;");
5160 expect(declaration.semicolon, isNotNull); 5160 expect(declaration.semicolon, isNotNull);
5161 expect(declaration.variables, isNotNull); 5161 expect(declaration.variables, isNotNull);
5162 } 5162 }
5163 5163
5164 void test_parseCompilationUnitMember_variableGet() { 5164 void test_parseCompilationUnitMember_variableGet() {
5165 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;"); 5165 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;");
(...skipping 25 matching lines...) Expand all
5191 expect(name.period, isNull); 5191 expect(name.period, isNull);
5192 expect(name.name, isNull); 5192 expect(name.name, isNull);
5193 expect(expression.argumentList, isNotNull); 5193 expect(expression.argumentList, isNotNull);
5194 } 5194 }
5195 5195
5196 void test_parseConstExpression_listLiteral_typed() { 5196 void test_parseConstExpression_listLiteral_typed() {
5197 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const < A> []", []); 5197 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const < A> []", []);
5198 expect(literal.constKeyword, isNotNull); 5198 expect(literal.constKeyword, isNotNull);
5199 expect(literal.typeArguments, isNotNull); 5199 expect(literal.typeArguments, isNotNull);
5200 expect(literal.leftBracket, isNotNull); 5200 expect(literal.leftBracket, isNotNull);
5201 EngineTestCase.assertSizeOfList(0, literal.elements); 5201 expect(literal.elements, hasLength(0));
5202 expect(literal.rightBracket, isNotNull); 5202 expect(literal.rightBracket, isNotNull);
5203 } 5203 }
5204 5204
5205 void test_parseConstExpression_listLiteral_untyped() { 5205 void test_parseConstExpression_listLiteral_untyped() {
5206 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const [ ]", []); 5206 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const [ ]", []);
5207 expect(literal.constKeyword, isNotNull); 5207 expect(literal.constKeyword, isNotNull);
5208 expect(literal.typeArguments, isNull); 5208 expect(literal.typeArguments, isNull);
5209 expect(literal.leftBracket, isNotNull); 5209 expect(literal.leftBracket, isNotNull);
5210 EngineTestCase.assertSizeOfList(0, literal.elements); 5210 expect(literal.elements, hasLength(0));
5211 expect(literal.rightBracket, isNotNull); 5211 expect(literal.rightBracket, isNotNull);
5212 } 5212 }
5213 5213
5214 void test_parseConstExpression_mapLiteral_typed() { 5214 void test_parseConstExpression_mapLiteral_typed() {
5215 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A , B> {}", []); 5215 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A , B> {}", []);
5216 expect(literal.leftBracket, isNotNull); 5216 expect(literal.leftBracket, isNotNull);
5217 EngineTestCase.assertSizeOfList(0, literal.entries); 5217 expect(literal.entries, hasLength(0));
5218 expect(literal.rightBracket, isNotNull); 5218 expect(literal.rightBracket, isNotNull);
5219 expect(literal.typeArguments, isNotNull); 5219 expect(literal.typeArguments, isNotNull);
5220 } 5220 }
5221 5221
5222 void test_parseConstExpression_mapLiteral_untyped() { 5222 void test_parseConstExpression_mapLiteral_untyped() {
5223 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {} ", []); 5223 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {} ", []);
5224 expect(literal.leftBracket, isNotNull); 5224 expect(literal.leftBracket, isNotNull);
5225 EngineTestCase.assertSizeOfList(0, literal.entries); 5225 expect(literal.entries, hasLength(0));
5226 expect(literal.rightBracket, isNotNull); 5226 expect(literal.rightBracket, isNotNull);
5227 expect(literal.typeArguments, isNull); 5227 expect(literal.typeArguments, isNull);
5228 } 5228 }
5229 5229
5230 void test_parseConstructor() { 5230 void test_parseConstructor() {
5231 // TODO(brianwilkerson) Implement tests for this method. 5231 // TODO(brianwilkerson) Implement tests for this method.
5232 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class , 5232 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class ,
5233 // Token.class, Token.class, SimpleIdentifier.class, Token.class, 5233 // Token.class, Token.class, SimpleIdentifier.class, Token.class,
5234 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] { emptyCommentAndMetadata(), 5234 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] { emptyCommentAndMetadata(),
5235 // null, null, null, null, null, null}, ""); 5235 // null, null, null, null, null, null}, "");
5236 } 5236 }
5237 5237
5238 void test_parseConstructor_with_pseudo_function_literal() { 5238 void test_parseConstructor_with_pseudo_function_literal() {
5239 // "(b) {}" should not be misinterpreted as a function literal even though i t looks like one. 5239 // "(b) {}" should not be misinterpreted as a function literal even though i t looks like one.
5240 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object> ["C"], "C() : a = (b) {}"); 5240 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object> ["C"], "C() : a = (b) {}");
5241 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons tructorDeclaration, classMember); 5241 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons tructorDeclaration, classMember);
5242 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; 5242 ConstructorDeclaration constructor = classMember as ConstructorDeclaration;
5243 NodeList<ConstructorInitializer> initializers = constructor.initializers; 5243 NodeList<ConstructorInitializer> initializers = constructor.initializers;
5244 EngineTestCase.assertSizeOfList(1, initializers); 5244 expect(initializers, hasLength(1));
5245 ConstructorInitializer initializer = initializers[0]; 5245 ConstructorInitializer initializer = initializers[0];
5246 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorFieldInitializer, ConstructorFieldInitializer, initializer); 5246 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorFieldInitializer, ConstructorFieldInitializer, initializer);
5247 EngineTestCase.assertInstanceOf((obj) => obj is ParenthesizedExpression, Par enthesizedExpression, (initializer as ConstructorFieldInitializer).expression); 5247 EngineTestCase.assertInstanceOf((obj) => obj is ParenthesizedExpression, Par enthesizedExpression, (initializer as ConstructorFieldInitializer).expression);
5248 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, constructor.body); 5248 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, constructor.body);
5249 } 5249 }
5250 5250
5251 void test_parseConstructorFieldInitializer_qualified() { 5251 void test_parseConstructorFieldInitializer_qualified() {
5252 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "this.a = b", []); 5252 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "this.a = b", []);
5253 expect(invocation.equals, isNotNull); 5253 expect(invocation.equals, isNotNull);
5254 expect(invocation.expression, isNotNull); 5254 expect(invocation.expression, isNotNull);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
5305 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 5305 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
5306 expect(statement.keyword, isNotNull); 5306 expect(statement.keyword, isNotNull);
5307 expect(statement.label, isNull); 5307 expect(statement.label, isNull);
5308 expect(statement.semicolon, isNotNull); 5308 expect(statement.semicolon, isNotNull);
5309 } 5309 }
5310 5310
5311 void test_parseDirective_export() { 5311 void test_parseDirective_export() {
5312 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';"); 5312 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
5313 expect(directive.keyword, isNotNull); 5313 expect(directive.keyword, isNotNull);
5314 expect(directive.uri, isNotNull); 5314 expect(directive.uri, isNotNull);
5315 EngineTestCase.assertSizeOfList(0, directive.combinators); 5315 expect(directive.combinators, hasLength(0));
5316 expect(directive.semicolon, isNotNull); 5316 expect(directive.semicolon, isNotNull);
5317 } 5317 }
5318 5318
5319 void test_parseDirective_import() { 5319 void test_parseDirective_import() {
5320 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';"); 5320 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
5321 expect(directive.keyword, isNotNull); 5321 expect(directive.keyword, isNotNull);
5322 expect(directive.uri, isNotNull); 5322 expect(directive.uri, isNotNull);
5323 expect(directive.asToken, isNull); 5323 expect(directive.asToken, isNull);
5324 expect(directive.prefix, isNull); 5324 expect(directive.prefix, isNull);
5325 EngineTestCase.assertSizeOfList(0, directive.combinators); 5325 expect(directive.combinators, hasLength(0));
5326 expect(directive.semicolon, isNotNull); 5326 expect(directive.semicolon, isNotNull);
5327 } 5327 }
5328 5328
5329 void test_parseDirective_library() { 5329 void test_parseDirective_library() {
5330 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;"); 5330 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;");
5331 expect(directive.libraryToken, isNotNull); 5331 expect(directive.libraryToken, isNotNull);
5332 expect(directive.name, isNotNull); 5332 expect(directive.name, isNotNull);
5333 expect(directive.semicolon, isNotNull); 5333 expect(directive.semicolon, isNotNull);
5334 } 5334 }
5335 5335
5336 void test_parseDirective_part() { 5336 void test_parseDirective_part() {
5337 PartDirective directive = ParserTestCase.parse("parseDirective", <Object> [e mptyCommentAndMetadata()], "part 'lib/lib.dart';"); 5337 PartDirective directive = ParserTestCase.parse("parseDirective", <Object> [e mptyCommentAndMetadata()], "part 'lib/lib.dart';");
5338 expect(directive.partToken, isNotNull); 5338 expect(directive.partToken, isNotNull);
5339 expect(directive.uri, isNotNull); 5339 expect(directive.uri, isNotNull);
5340 expect(directive.semicolon, isNotNull); 5340 expect(directive.semicolon, isNotNull);
5341 } 5341 }
5342 5342
5343 void test_parseDirective_partOf() { 5343 void test_parseDirective_partOf() {
5344 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;"); 5344 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;");
5345 expect(directive.partToken, isNotNull); 5345 expect(directive.partToken, isNotNull);
5346 expect(directive.ofToken, isNotNull); 5346 expect(directive.ofToken, isNotNull);
5347 expect(directive.libraryName, isNotNull); 5347 expect(directive.libraryName, isNotNull);
5348 expect(directive.semicolon, isNotNull); 5348 expect(directive.semicolon, isNotNull);
5349 } 5349 }
5350 5350
5351 void test_parseDirectives_complete() { 5351 void test_parseDirectives_complete() {
5352 CompilationUnit unit = _parseDirectives("#! /bin/dart\nlibrary l;\nclass A { }", []); 5352 CompilationUnit unit = _parseDirectives("#! /bin/dart\nlibrary l;\nclass A { }", []);
5353 expect(unit.scriptTag, isNotNull); 5353 expect(unit.scriptTag, isNotNull);
5354 EngineTestCase.assertSizeOfList(1, unit.directives); 5354 expect(unit.directives, hasLength(1));
5355 } 5355 }
5356 5356
5357 void test_parseDirectives_empty() { 5357 void test_parseDirectives_empty() {
5358 CompilationUnit unit = _parseDirectives("", []); 5358 CompilationUnit unit = _parseDirectives("", []);
5359 expect(unit.scriptTag, isNull); 5359 expect(unit.scriptTag, isNull);
5360 EngineTestCase.assertSizeOfList(0, unit.directives); 5360 expect(unit.directives, hasLength(0));
5361 } 5361 }
5362 5362
5363 void test_parseDirectives_mixed() { 5363 void test_parseDirectives_mixed() {
5364 CompilationUnit unit = _parseDirectives("library l; class A {} part 'foo.dar t';", []); 5364 CompilationUnit unit = _parseDirectives("library l; class A {} part 'foo.dar t';", []);
5365 expect(unit.scriptTag, isNull); 5365 expect(unit.scriptTag, isNull);
5366 EngineTestCase.assertSizeOfList(1, unit.directives); 5366 expect(unit.directives, hasLength(1));
5367 } 5367 }
5368 5368
5369 void test_parseDirectives_multiple() { 5369 void test_parseDirectives_multiple() {
5370 CompilationUnit unit = _parseDirectives("library l;\npart 'a.dart';", []); 5370 CompilationUnit unit = _parseDirectives("library l;\npart 'a.dart';", []);
5371 expect(unit.scriptTag, isNull); 5371 expect(unit.scriptTag, isNull);
5372 EngineTestCase.assertSizeOfList(2, unit.directives); 5372 expect(unit.directives, hasLength(2));
5373 } 5373 }
5374 5374
5375 void test_parseDirectives_script() { 5375 void test_parseDirectives_script() {
5376 CompilationUnit unit = _parseDirectives("#! /bin/dart", []); 5376 CompilationUnit unit = _parseDirectives("#! /bin/dart", []);
5377 expect(unit.scriptTag, isNotNull); 5377 expect(unit.scriptTag, isNotNull);
5378 EngineTestCase.assertSizeOfList(0, unit.directives); 5378 expect(unit.directives, hasLength(0));
5379 } 5379 }
5380 5380
5381 void test_parseDirectives_single() { 5381 void test_parseDirectives_single() {
5382 CompilationUnit unit = _parseDirectives("library l;", []); 5382 CompilationUnit unit = _parseDirectives("library l;", []);
5383 expect(unit.scriptTag, isNull); 5383 expect(unit.scriptTag, isNull);
5384 EngineTestCase.assertSizeOfList(1, unit.directives); 5384 expect(unit.directives, hasLength(1));
5385 } 5385 }
5386 5386
5387 void test_parseDirectives_topLevelDeclaration() { 5387 void test_parseDirectives_topLevelDeclaration() {
5388 CompilationUnit unit = _parseDirectives("class A {}", []); 5388 CompilationUnit unit = _parseDirectives("class A {}", []);
5389 expect(unit.scriptTag, isNull); 5389 expect(unit.scriptTag, isNull);
5390 EngineTestCase.assertSizeOfList(0, unit.directives); 5390 expect(unit.directives, hasLength(0));
5391 } 5391 }
5392 5392
5393 void test_parseDocumentationComment_block() { 5393 void test_parseDocumentationComment_block() {
5394 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** */ class", []); 5394 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** */ class", []);
5395 expect(comment.isBlock, isFalse); 5395 expect(comment.isBlock, isFalse);
5396 expect(comment.isDocumentation, isTrue); 5396 expect(comment.isDocumentation, isTrue);
5397 expect(comment.isEndOfLine, isFalse); 5397 expect(comment.isEndOfLine, isFalse);
5398 } 5398 }
5399 5399
5400 void test_parseDocumentationComment_block_withReference() { 5400 void test_parseDocumentationComment_block_withReference() {
5401 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** [a ] */ class", []); 5401 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** [a ] */ class", []);
5402 expect(comment.isBlock, isFalse); 5402 expect(comment.isBlock, isFalse);
5403 expect(comment.isDocumentation, isTrue); 5403 expect(comment.isDocumentation, isTrue);
5404 expect(comment.isEndOfLine, isFalse); 5404 expect(comment.isEndOfLine, isFalse);
5405 NodeList<CommentReference> references = comment.references; 5405 NodeList<CommentReference> references = comment.references;
5406 EngineTestCase.assertSizeOfList(1, references); 5406 expect(references, hasLength(1));
5407 CommentReference reference = references[0]; 5407 CommentReference reference = references[0];
5408 expect(reference, isNotNull); 5408 expect(reference, isNotNull);
5409 expect(reference.offset, 5); 5409 expect(reference.offset, 5);
5410 } 5410 }
5411 5411
5412 void test_parseDocumentationComment_endOfLine() { 5412 void test_parseDocumentationComment_endOfLine() {
5413 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/// \n /// \n class", []); 5413 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/// \n /// \n class", []);
5414 expect(comment.isBlock, isFalse); 5414 expect(comment.isBlock, isFalse);
5415 expect(comment.isDocumentation, isTrue); 5415 expect(comment.isDocumentation, isTrue);
5416 expect(comment.isEndOfLine, isFalse); 5416 expect(comment.isEndOfLine, isFalse);
(...skipping 14 matching lines...) Expand all
5431 EmptyStatement statement = ParserTestCase.parse4("parseEmptyStatement", ";", []); 5431 EmptyStatement statement = ParserTestCase.parse4("parseEmptyStatement", ";", []);
5432 expect(statement.semicolon, isNotNull); 5432 expect(statement.semicolon, isNotNull);
5433 } 5433 }
5434 5434
5435 void test_parseEnumDeclaration_one() { 5435 void test_parseEnumDeclaration_one() {
5436 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE}"); 5436 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE}");
5437 expect(declaration.documentationComment, isNull); 5437 expect(declaration.documentationComment, isNull);
5438 expect(declaration.keyword, isNotNull); 5438 expect(declaration.keyword, isNotNull);
5439 expect(declaration.leftBracket, isNotNull); 5439 expect(declaration.leftBracket, isNotNull);
5440 expect(declaration.name, isNotNull); 5440 expect(declaration.name, isNotNull);
5441 EngineTestCase.assertSizeOfList(1, declaration.constants); 5441 expect(declaration.constants, hasLength(1));
5442 expect(declaration.rightBracket, isNotNull); 5442 expect(declaration.rightBracket, isNotNull);
5443 } 5443 }
5444 5444
5445 void test_parseEnumDeclaration_trailingComma() { 5445 void test_parseEnumDeclaration_trailingComma() {
5446 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE,}"); 5446 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE,}");
5447 expect(declaration.documentationComment, isNull); 5447 expect(declaration.documentationComment, isNull);
5448 expect(declaration.keyword, isNotNull); 5448 expect(declaration.keyword, isNotNull);
5449 expect(declaration.leftBracket, isNotNull); 5449 expect(declaration.leftBracket, isNotNull);
5450 expect(declaration.name, isNotNull); 5450 expect(declaration.name, isNotNull);
5451 EngineTestCase.assertSizeOfList(1, declaration.constants); 5451 expect(declaration.constants, hasLength(1));
5452 expect(declaration.rightBracket, isNotNull); 5452 expect(declaration.rightBracket, isNotNull);
5453 } 5453 }
5454 5454
5455 void test_parseEnumDeclaration_two() { 5455 void test_parseEnumDeclaration_two() {
5456 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE, TWO}"); 5456 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE, TWO}");
5457 expect(declaration.documentationComment, isNull); 5457 expect(declaration.documentationComment, isNull);
5458 expect(declaration.keyword, isNotNull); 5458 expect(declaration.keyword, isNotNull);
5459 expect(declaration.leftBracket, isNotNull); 5459 expect(declaration.leftBracket, isNotNull);
5460 expect(declaration.name, isNotNull); 5460 expect(declaration.name, isNotNull);
5461 EngineTestCase.assertSizeOfList(2, declaration.constants); 5461 expect(declaration.constants, hasLength(2));
5462 expect(declaration.rightBracket, isNotNull); 5462 expect(declaration.rightBracket, isNotNull);
5463 } 5463 }
5464 5464
5465 void test_parseEqualityExpression_normal() { 5465 void test_parseEqualityExpression_normal() {
5466 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "x == y", []); 5466 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "x == y", []);
5467 expect(expression.leftOperand, isNotNull); 5467 expect(expression.leftOperand, isNotNull);
5468 expect(expression.operator, isNotNull); 5468 expect(expression.operator, isNotNull);
5469 expect(expression.operator.type, TokenType.EQ_EQ); 5469 expect(expression.operator.type, TokenType.EQ_EQ);
5470 expect(expression.rightOperand, isNotNull); 5470 expect(expression.rightOperand, isNotNull);
5471 } 5471 }
5472 5472
5473 void test_parseEqualityExpression_super() { 5473 void test_parseEqualityExpression_super() {
5474 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "super == y", []); 5474 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "super == y", []);
5475 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 5475 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
5476 expect(expression.operator, isNotNull); 5476 expect(expression.operator, isNotNull);
5477 expect(expression.operator.type, TokenType.EQ_EQ); 5477 expect(expression.operator.type, TokenType.EQ_EQ);
5478 expect(expression.rightOperand, isNotNull); 5478 expect(expression.rightOperand, isNotNull);
5479 } 5479 }
5480 5480
5481 void test_parseExportDirective_hide() { 5481 void test_parseExportDirective_hide() {
5482 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A, B;"); 5482 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A, B;");
5483 expect(directive.keyword, isNotNull); 5483 expect(directive.keyword, isNotNull);
5484 expect(directive.uri, isNotNull); 5484 expect(directive.uri, isNotNull);
5485 EngineTestCase.assertSizeOfList(1, directive.combinators); 5485 expect(directive.combinators, hasLength(1));
5486 expect(directive.semicolon, isNotNull); 5486 expect(directive.semicolon, isNotNull);
5487 } 5487 }
5488 5488
5489 void test_parseExportDirective_hide_show() { 5489 void test_parseExportDirective_hide_show() {
5490 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A show B;"); 5490 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A show B;");
5491 expect(directive.keyword, isNotNull); 5491 expect(directive.keyword, isNotNull);
5492 expect(directive.uri, isNotNull); 5492 expect(directive.uri, isNotNull);
5493 EngineTestCase.assertSizeOfList(2, directive.combinators); 5493 expect(directive.combinators, hasLength(2));
5494 expect(directive.semicolon, isNotNull); 5494 expect(directive.semicolon, isNotNull);
5495 } 5495 }
5496 5496
5497 void test_parseExportDirective_noCombinator() { 5497 void test_parseExportDirective_noCombinator() {
5498 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart';"); 5498 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
5499 expect(directive.keyword, isNotNull); 5499 expect(directive.keyword, isNotNull);
5500 expect(directive.uri, isNotNull); 5500 expect(directive.uri, isNotNull);
5501 EngineTestCase.assertSizeOfList(0, directive.combinators); 5501 expect(directive.combinators, hasLength(0));
5502 expect(directive.semicolon, isNotNull); 5502 expect(directive.semicolon, isNotNull);
5503 } 5503 }
5504 5504
5505 void test_parseExportDirective_show() { 5505 void test_parseExportDirective_show() {
5506 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show A, B;"); 5506 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show A, B;");
5507 expect(directive.keyword, isNotNull); 5507 expect(directive.keyword, isNotNull);
5508 expect(directive.uri, isNotNull); 5508 expect(directive.uri, isNotNull);
5509 EngineTestCase.assertSizeOfList(1, directive.combinators); 5509 expect(directive.combinators, hasLength(1));
5510 expect(directive.semicolon, isNotNull); 5510 expect(directive.semicolon, isNotNull);
5511 } 5511 }
5512 5512
5513 void test_parseExportDirective_show_hide() { 5513 void test_parseExportDirective_show_hide() {
5514 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show B hide A;"); 5514 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show B hide A;");
5515 expect(directive.keyword, isNotNull); 5515 expect(directive.keyword, isNotNull);
5516 expect(directive.uri, isNotNull); 5516 expect(directive.uri, isNotNull);
5517 EngineTestCase.assertSizeOfList(2, directive.combinators); 5517 expect(directive.combinators, hasLength(2));
5518 expect(directive.semicolon, isNotNull); 5518 expect(directive.semicolon, isNotNull);
5519 } 5519 }
5520 5520
5521 void test_parseExpression_assign() { 5521 void test_parseExpression_assign() {
5522 // TODO(brianwilkerson) Implement more tests for this method. 5522 // TODO(brianwilkerson) Implement more tests for this method.
5523 AssignmentExpression expression = ParserTestCase.parse4("parseExpression", " x = y", []); 5523 AssignmentExpression expression = ParserTestCase.parse4("parseExpression", " x = y", []);
5524 expect(expression.leftHandSide, isNotNull); 5524 expect(expression.leftHandSide, isNotNull);
5525 expect(expression.operator, isNotNull); 5525 expect(expression.operator, isNotNull);
5526 expect(expression.operator.type, TokenType.EQ); 5526 expect(expression.operator.type, TokenType.EQ);
5527 expect(expression.rightHandSide, isNotNull); 5527 expect(expression.rightHandSide, isNotNull);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5568 } 5568 }
5569 5569
5570 void test_parseExpression_invokeFunctionExpression() { 5570 void test_parseExpression_invokeFunctionExpression() {
5571 FunctionExpressionInvocation invocation = ParserTestCase.parse4("parseExpres sion", "(a) {return a + a;} (3)", []); 5571 FunctionExpressionInvocation invocation = ParserTestCase.parse4("parseExpres sion", "(a) {return a + a;} (3)", []);
5572 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function); 5572 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function);
5573 FunctionExpression expression = invocation.function as FunctionExpression; 5573 FunctionExpression expression = invocation.function as FunctionExpression;
5574 expect(expression.parameters, isNotNull); 5574 expect(expression.parameters, isNotNull);
5575 expect(expression.body, isNotNull); 5575 expect(expression.body, isNotNull);
5576 ArgumentList list = invocation.argumentList; 5576 ArgumentList list = invocation.argumentList;
5577 expect(list, isNotNull); 5577 expect(list, isNotNull);
5578 EngineTestCase.assertSizeOfList(1, list.arguments); 5578 expect(list.arguments, hasLength(1));
5579 } 5579 }
5580 5580
5581 void test_parseExpression_superMethodInvocation() { 5581 void test_parseExpression_superMethodInvocation() {
5582 MethodInvocation invocation = ParserTestCase.parse4("parseExpression", "supe r.m()", []); 5582 MethodInvocation invocation = ParserTestCase.parse4("parseExpression", "supe r.m()", []);
5583 expect(invocation.target, isNotNull); 5583 expect(invocation.target, isNotNull);
5584 expect(invocation.methodName, isNotNull); 5584 expect(invocation.methodName, isNotNull);
5585 expect(invocation.argumentList, isNotNull); 5585 expect(invocation.argumentList, isNotNull);
5586 } 5586 }
5587 5587
5588 void test_parseExpressionList_multiple() { 5588 void test_parseExpressionList_multiple() {
5589 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3", []); 5589 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3", []);
5590 EngineTestCase.assertSizeOfList(3, result); 5590 expect(result, hasLength(3));
5591 } 5591 }
5592 5592
5593 void test_parseExpressionList_single() { 5593 void test_parseExpressionList_single() {
5594 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1", []); 5594 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1", []);
5595 EngineTestCase.assertSizeOfList(1, result); 5595 expect(result, hasLength(1));
5596 } 5596 }
5597 5597
5598 void test_parseExpressionWithoutCascade_assign() { 5598 void test_parseExpressionWithoutCascade_assign() {
5599 // TODO(brianwilkerson) Implement more tests for this method. 5599 // TODO(brianwilkerson) Implement more tests for this method.
5600 AssignmentExpression expression = ParserTestCase.parse4("parseExpressionWith outCascade", "x = y", []); 5600 AssignmentExpression expression = ParserTestCase.parse4("parseExpressionWith outCascade", "x = y", []);
5601 expect(expression.leftHandSide, isNotNull); 5601 expect(expression.leftHandSide, isNotNull);
5602 expect(expression.operator, isNotNull); 5602 expect(expression.operator, isNotNull);
5603 expect(expression.operator.type, TokenType.EQ); 5603 expect(expression.operator.type, TokenType.EQ);
5604 expect(expression.rightHandSide, isNotNull); 5604 expect(expression.rightHandSide, isNotNull);
5605 } 5605 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5806 expect(simpleParameter.kind, kind); 5806 expect(simpleParameter.kind, kind);
5807 expect(parameter.separator, isNotNull); 5807 expect(parameter.separator, isNotNull);
5808 expect(parameter.defaultValue, isNotNull); 5808 expect(parameter.defaultValue, isNotNull);
5809 expect(parameter.kind, kind); 5809 expect(parameter.kind, kind);
5810 } 5810 }
5811 5811
5812 void test_parseFormalParameterList_empty() { 5812 void test_parseFormalParameterList_empty() {
5813 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "()", []); 5813 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "()", []);
5814 expect(parameterList.leftParenthesis, isNotNull); 5814 expect(parameterList.leftParenthesis, isNotNull);
5815 expect(parameterList.leftDelimiter, isNull); 5815 expect(parameterList.leftDelimiter, isNull);
5816 EngineTestCase.assertSizeOfList(0, parameterList.parameters); 5816 expect(parameterList.parameters, hasLength(0));
5817 expect(parameterList.rightDelimiter, isNull); 5817 expect(parameterList.rightDelimiter, isNull);
5818 expect(parameterList.rightParenthesis, isNotNull); 5818 expect(parameterList.rightParenthesis, isNotNull);
5819 } 5819 }
5820 5820
5821 void test_parseFormalParameterList_named_multiple() { 5821 void test_parseFormalParameterList_named_multiple() {
5822 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a : 1, B b, C c : 3})", []); 5822 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a : 1, B b, C c : 3})", []);
5823 expect(parameterList.leftParenthesis, isNotNull); 5823 expect(parameterList.leftParenthesis, isNotNull);
5824 expect(parameterList.leftDelimiter, isNotNull); 5824 expect(parameterList.leftDelimiter, isNotNull);
5825 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5825 expect(parameterList.parameters, hasLength(3));
5826 expect(parameterList.rightDelimiter, isNotNull); 5826 expect(parameterList.rightDelimiter, isNotNull);
5827 expect(parameterList.rightParenthesis, isNotNull); 5827 expect(parameterList.rightParenthesis, isNotNull);
5828 } 5828 }
5829 5829
5830 void test_parseFormalParameterList_named_single() { 5830 void test_parseFormalParameterList_named_single() {
5831 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a})", []); 5831 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a})", []);
5832 expect(parameterList.leftParenthesis, isNotNull); 5832 expect(parameterList.leftParenthesis, isNotNull);
5833 expect(parameterList.leftDelimiter, isNotNull); 5833 expect(parameterList.leftDelimiter, isNotNull);
5834 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5834 expect(parameterList.parameters, hasLength(1));
5835 expect(parameterList.rightDelimiter, isNotNull); 5835 expect(parameterList.rightDelimiter, isNotNull);
5836 expect(parameterList.rightParenthesis, isNotNull); 5836 expect(parameterList.rightParenthesis, isNotNull);
5837 } 5837 }
5838 5838
5839 void test_parseFormalParameterList_normal_multiple() { 5839 void test_parseFormalParameterList_normal_multiple() {
5840 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, B b, C c)", []); 5840 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, B b, C c)", []);
5841 expect(parameterList.leftParenthesis, isNotNull); 5841 expect(parameterList.leftParenthesis, isNotNull);
5842 expect(parameterList.leftDelimiter, isNull); 5842 expect(parameterList.leftDelimiter, isNull);
5843 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5843 expect(parameterList.parameters, hasLength(3));
5844 expect(parameterList.rightDelimiter, isNull); 5844 expect(parameterList.rightDelimiter, isNull);
5845 expect(parameterList.rightParenthesis, isNotNull); 5845 expect(parameterList.rightParenthesis, isNotNull);
5846 } 5846 }
5847 5847
5848 void test_parseFormalParameterList_normal_named() { 5848 void test_parseFormalParameterList_normal_named() {
5849 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, {B b})", []); 5849 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, {B b})", []);
5850 expect(parameterList.leftParenthesis, isNotNull); 5850 expect(parameterList.leftParenthesis, isNotNull);
5851 expect(parameterList.leftDelimiter, isNotNull); 5851 expect(parameterList.leftDelimiter, isNotNull);
5852 EngineTestCase.assertSizeOfList(2, parameterList.parameters); 5852 expect(parameterList.parameters, hasLength(2));
5853 expect(parameterList.rightDelimiter, isNotNull); 5853 expect(parameterList.rightDelimiter, isNotNull);
5854 expect(parameterList.rightParenthesis, isNotNull); 5854 expect(parameterList.rightParenthesis, isNotNull);
5855 } 5855 }
5856 5856
5857 void test_parseFormalParameterList_normal_positional() { 5857 void test_parseFormalParameterList_normal_positional() {
5858 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, [B b])", []); 5858 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, [B b])", []);
5859 expect(parameterList.leftParenthesis, isNotNull); 5859 expect(parameterList.leftParenthesis, isNotNull);
5860 expect(parameterList.leftDelimiter, isNotNull); 5860 expect(parameterList.leftDelimiter, isNotNull);
5861 EngineTestCase.assertSizeOfList(2, parameterList.parameters); 5861 expect(parameterList.parameters, hasLength(2));
5862 expect(parameterList.rightDelimiter, isNotNull); 5862 expect(parameterList.rightDelimiter, isNotNull);
5863 expect(parameterList.rightParenthesis, isNotNull); 5863 expect(parameterList.rightParenthesis, isNotNull);
5864 } 5864 }
5865 5865
5866 void test_parseFormalParameterList_normal_single() { 5866 void test_parseFormalParameterList_normal_single() {
5867 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a)", []); 5867 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a)", []);
5868 expect(parameterList.leftParenthesis, isNotNull); 5868 expect(parameterList.leftParenthesis, isNotNull);
5869 expect(parameterList.leftDelimiter, isNull); 5869 expect(parameterList.leftDelimiter, isNull);
5870 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5870 expect(parameterList.parameters, hasLength(1));
5871 expect(parameterList.rightDelimiter, isNull); 5871 expect(parameterList.rightDelimiter, isNull);
5872 expect(parameterList.rightParenthesis, isNotNull); 5872 expect(parameterList.rightParenthesis, isNotNull);
5873 } 5873 }
5874 5874
5875 void test_parseFormalParameterList_positional_multiple() { 5875 void test_parseFormalParameterList_positional_multiple() {
5876 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null, B b, C c = null])", []); 5876 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null, B b, C c = null])", []);
5877 expect(parameterList.leftParenthesis, isNotNull); 5877 expect(parameterList.leftParenthesis, isNotNull);
5878 expect(parameterList.leftDelimiter, isNotNull); 5878 expect(parameterList.leftDelimiter, isNotNull);
5879 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5879 expect(parameterList.parameters, hasLength(3));
5880 expect(parameterList.rightDelimiter, isNotNull); 5880 expect(parameterList.rightDelimiter, isNotNull);
5881 expect(parameterList.rightParenthesis, isNotNull); 5881 expect(parameterList.rightParenthesis, isNotNull);
5882 } 5882 }
5883 5883
5884 void test_parseFormalParameterList_positional_single() { 5884 void test_parseFormalParameterList_positional_single() {
5885 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null])", []); 5885 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null])", []);
5886 expect(parameterList.leftParenthesis, isNotNull); 5886 expect(parameterList.leftParenthesis, isNotNull);
5887 expect(parameterList.leftDelimiter, isNotNull); 5887 expect(parameterList.leftDelimiter, isNotNull);
5888 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5888 expect(parameterList.parameters, hasLength(1));
5889 expect(parameterList.rightDelimiter, isNotNull); 5889 expect(parameterList.rightDelimiter, isNotNull);
5890 expect(parameterList.rightParenthesis, isNotNull); 5890 expect(parameterList.rightParenthesis, isNotNull);
5891 } 5891 }
5892 5892
5893 void test_parseForStatement_each_await() { 5893 void test_parseForStatement_each_await() {
5894 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "awa it for (element in list) {}", []); 5894 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "awa it for (element in list) {}", []);
5895 expect(statement.awaitKeyword, isNotNull); 5895 expect(statement.awaitKeyword, isNotNull);
5896 expect(statement.forKeyword, isNotNull); 5896 expect(statement.forKeyword, isNotNull);
5897 expect(statement.leftParenthesis, isNotNull); 5897 expect(statement.leftParenthesis, isNotNull);
5898 expect(statement.loopVariable, isNull); 5898 expect(statement.loopVariable, isNull);
(...skipping 16 matching lines...) Expand all
5915 expect(statement.rightParenthesis, isNotNull); 5915 expect(statement.rightParenthesis, isNotNull);
5916 expect(statement.body, isNotNull); 5916 expect(statement.body, isNotNull);
5917 } 5917 }
5918 5918
5919 void test_parseForStatement_each_noType_metadata() { 5919 void test_parseForStatement_each_noType_metadata() {
5920 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}", []); 5920 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}", []);
5921 expect(statement.awaitKeyword, isNull); 5921 expect(statement.awaitKeyword, isNull);
5922 expect(statement.forKeyword, isNotNull); 5922 expect(statement.forKeyword, isNotNull);
5923 expect(statement.leftParenthesis, isNotNull); 5923 expect(statement.leftParenthesis, isNotNull);
5924 expect(statement.loopVariable, isNotNull); 5924 expect(statement.loopVariable, isNotNull);
5925 EngineTestCase.assertSizeOfList(1, statement.loopVariable.metadata); 5925 expect(statement.loopVariable.metadata, hasLength(1));
5926 expect(statement.identifier, isNull); 5926 expect(statement.identifier, isNull);
5927 expect(statement.inKeyword, isNotNull); 5927 expect(statement.inKeyword, isNotNull);
5928 expect(statement.iterator, isNotNull); 5928 expect(statement.iterator, isNotNull);
5929 expect(statement.rightParenthesis, isNotNull); 5929 expect(statement.rightParenthesis, isNotNull);
5930 expect(statement.body, isNotNull); 5930 expect(statement.body, isNotNull);
5931 } 5931 }
5932 5932
5933 void test_parseForStatement_each_type() { 5933 void test_parseForStatement_each_type() {
5934 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (A element in list) {}", []); 5934 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (A element in list) {}", []);
5935 expect(statement.awaitKeyword, isNull); 5935 expect(statement.awaitKeyword, isNull);
(...skipping 22 matching lines...) Expand all
5958 5958
5959 void test_parseForStatement_loop_c() { 5959 void test_parseForStatement_loop_c() {
5960 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}", []); 5960 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}", []);
5961 expect(statement.forKeyword, isNotNull); 5961 expect(statement.forKeyword, isNotNull);
5962 expect(statement.leftParenthesis, isNotNull); 5962 expect(statement.leftParenthesis, isNotNull);
5963 expect(statement.variables, isNull); 5963 expect(statement.variables, isNull);
5964 expect(statement.initialization, isNull); 5964 expect(statement.initialization, isNull);
5965 expect(statement.leftSeparator, isNotNull); 5965 expect(statement.leftSeparator, isNotNull);
5966 expect(statement.condition, isNotNull); 5966 expect(statement.condition, isNotNull);
5967 expect(statement.rightSeparator, isNotNull); 5967 expect(statement.rightSeparator, isNotNull);
5968 EngineTestCase.assertSizeOfList(0, statement.updaters); 5968 expect(statement.updaters, hasLength(0));
5969 expect(statement.rightParenthesis, isNotNull); 5969 expect(statement.rightParenthesis, isNotNull);
5970 expect(statement.body, isNotNull); 5970 expect(statement.body, isNotNull);
5971 } 5971 }
5972 5972
5973 void test_parseForStatement_loop_cu() { 5973 void test_parseForStatement_loop_cu() {
5974 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}", []); 5974 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}", []);
5975 expect(statement.forKeyword, isNotNull); 5975 expect(statement.forKeyword, isNotNull);
5976 expect(statement.leftParenthesis, isNotNull); 5976 expect(statement.leftParenthesis, isNotNull);
5977 expect(statement.variables, isNull); 5977 expect(statement.variables, isNull);
5978 expect(statement.initialization, isNull); 5978 expect(statement.initialization, isNull);
5979 expect(statement.leftSeparator, isNotNull); 5979 expect(statement.leftSeparator, isNotNull);
5980 expect(statement.condition, isNotNull); 5980 expect(statement.condition, isNotNull);
5981 expect(statement.rightSeparator, isNotNull); 5981 expect(statement.rightSeparator, isNotNull);
5982 EngineTestCase.assertSizeOfList(1, statement.updaters); 5982 expect(statement.updaters, hasLength(1));
5983 expect(statement.rightParenthesis, isNotNull); 5983 expect(statement.rightParenthesis, isNotNull);
5984 expect(statement.body, isNotNull); 5984 expect(statement.body, isNotNull);
5985 } 5985 }
5986 5986
5987 void test_parseForStatement_loop_ecu() { 5987 void test_parseForStatement_loop_ecu() {
5988 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (i- -; i < count; i++) {}", []); 5988 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (i- -; i < count; i++) {}", []);
5989 expect(statement.forKeyword, isNotNull); 5989 expect(statement.forKeyword, isNotNull);
5990 expect(statement.leftParenthesis, isNotNull); 5990 expect(statement.leftParenthesis, isNotNull);
5991 expect(statement.variables, isNull); 5991 expect(statement.variables, isNull);
5992 expect(statement.initialization, isNotNull); 5992 expect(statement.initialization, isNotNull);
5993 expect(statement.leftSeparator, isNotNull); 5993 expect(statement.leftSeparator, isNotNull);
5994 expect(statement.condition, isNotNull); 5994 expect(statement.condition, isNotNull);
5995 expect(statement.rightSeparator, isNotNull); 5995 expect(statement.rightSeparator, isNotNull);
5996 EngineTestCase.assertSizeOfList(1, statement.updaters); 5996 expect(statement.updaters, hasLength(1));
5997 expect(statement.rightParenthesis, isNotNull); 5997 expect(statement.rightParenthesis, isNotNull);
5998 expect(statement.body, isNotNull); 5998 expect(statement.body, isNotNull);
5999 } 5999 }
6000 6000
6001 void test_parseForStatement_loop_i() { 6001 void test_parseForStatement_loop_i() {
6002 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;;) {}", []); 6002 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;;) {}", []);
6003 expect(statement.forKeyword, isNotNull); 6003 expect(statement.forKeyword, isNotNull);
6004 expect(statement.leftParenthesis, isNotNull); 6004 expect(statement.leftParenthesis, isNotNull);
6005 VariableDeclarationList variables = statement.variables; 6005 VariableDeclarationList variables = statement.variables;
6006 expect(variables, isNotNull); 6006 expect(variables, isNotNull);
6007 EngineTestCase.assertSizeOfList(0, variables.metadata); 6007 expect(variables.metadata, hasLength(0));
6008 EngineTestCase.assertSizeOfList(1, variables.variables); 6008 expect(variables.variables, hasLength(1));
6009 expect(statement.initialization, isNull); 6009 expect(statement.initialization, isNull);
6010 expect(statement.leftSeparator, isNotNull); 6010 expect(statement.leftSeparator, isNotNull);
6011 expect(statement.condition, isNull); 6011 expect(statement.condition, isNull);
6012 expect(statement.rightSeparator, isNotNull); 6012 expect(statement.rightSeparator, isNotNull);
6013 EngineTestCase.assertSizeOfList(0, statement.updaters); 6013 expect(statement.updaters, hasLength(0));
6014 expect(statement.rightParenthesis, isNotNull); 6014 expect(statement.rightParenthesis, isNotNull);
6015 expect(statement.body, isNotNull); 6015 expect(statement.body, isNotNull);
6016 } 6016 }
6017 6017
6018 void test_parseForStatement_loop_i_withMetadata() { 6018 void test_parseForStatement_loop_i_withMetadata() {
6019 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}", []); 6019 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}", []);
6020 expect(statement.forKeyword, isNotNull); 6020 expect(statement.forKeyword, isNotNull);
6021 expect(statement.leftParenthesis, isNotNull); 6021 expect(statement.leftParenthesis, isNotNull);
6022 VariableDeclarationList variables = statement.variables; 6022 VariableDeclarationList variables = statement.variables;
6023 expect(variables, isNotNull); 6023 expect(variables, isNotNull);
6024 EngineTestCase.assertSizeOfList(1, variables.metadata); 6024 expect(variables.metadata, hasLength(1));
6025 EngineTestCase.assertSizeOfList(1, variables.variables); 6025 expect(variables.variables, hasLength(1));
6026 expect(statement.initialization, isNull); 6026 expect(statement.initialization, isNull);
6027 expect(statement.leftSeparator, isNotNull); 6027 expect(statement.leftSeparator, isNotNull);
6028 expect(statement.condition, isNull); 6028 expect(statement.condition, isNull);
6029 expect(statement.rightSeparator, isNotNull); 6029 expect(statement.rightSeparator, isNotNull);
6030 EngineTestCase.assertSizeOfList(0, statement.updaters); 6030 expect(statement.updaters, hasLength(0));
6031 expect(statement.rightParenthesis, isNotNull); 6031 expect(statement.rightParenthesis, isNotNull);
6032 expect(statement.body, isNotNull); 6032 expect(statement.body, isNotNull);
6033 } 6033 }
6034 6034
6035 void test_parseForStatement_loop_ic() { 6035 void test_parseForStatement_loop_ic() {
6036 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0; i < count;) {}", []); 6036 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0; i < count;) {}", []);
6037 expect(statement.forKeyword, isNotNull); 6037 expect(statement.forKeyword, isNotNull);
6038 expect(statement.leftParenthesis, isNotNull); 6038 expect(statement.leftParenthesis, isNotNull);
6039 VariableDeclarationList variables = statement.variables; 6039 VariableDeclarationList variables = statement.variables;
6040 expect(variables, isNotNull); 6040 expect(variables, isNotNull);
6041 EngineTestCase.assertSizeOfList(1, variables.variables); 6041 expect(variables.variables, hasLength(1));
6042 expect(statement.initialization, isNull); 6042 expect(statement.initialization, isNull);
6043 expect(statement.leftSeparator, isNotNull); 6043 expect(statement.leftSeparator, isNotNull);
6044 expect(statement.condition, isNotNull); 6044 expect(statement.condition, isNotNull);
6045 expect(statement.rightSeparator, isNotNull); 6045 expect(statement.rightSeparator, isNotNull);
6046 EngineTestCase.assertSizeOfList(0, statement.updaters); 6046 expect(statement.updaters, hasLength(0));
6047 expect(statement.rightParenthesis, isNotNull); 6047 expect(statement.rightParenthesis, isNotNull);
6048 expect(statement.body, isNotNull); 6048 expect(statement.body, isNotNull);
6049 } 6049 }
6050 6050
6051 void test_parseForStatement_loop_icu() { 6051 void test_parseForStatement_loop_icu() {
6052 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0; i < count; i++) {}", []); 6052 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0; i < count; i++) {}", []);
6053 expect(statement.forKeyword, isNotNull); 6053 expect(statement.forKeyword, isNotNull);
6054 expect(statement.leftParenthesis, isNotNull); 6054 expect(statement.leftParenthesis, isNotNull);
6055 VariableDeclarationList variables = statement.variables; 6055 VariableDeclarationList variables = statement.variables;
6056 expect(variables, isNotNull); 6056 expect(variables, isNotNull);
6057 EngineTestCase.assertSizeOfList(1, variables.variables); 6057 expect(variables.variables, hasLength(1));
6058 expect(statement.initialization, isNull); 6058 expect(statement.initialization, isNull);
6059 expect(statement.leftSeparator, isNotNull); 6059 expect(statement.leftSeparator, isNotNull);
6060 expect(statement.condition, isNotNull); 6060 expect(statement.condition, isNotNull);
6061 expect(statement.rightSeparator, isNotNull); 6061 expect(statement.rightSeparator, isNotNull);
6062 EngineTestCase.assertSizeOfList(1, statement.updaters); 6062 expect(statement.updaters, hasLength(1));
6063 expect(statement.rightParenthesis, isNotNull); 6063 expect(statement.rightParenthesis, isNotNull);
6064 expect(statement.body, isNotNull); 6064 expect(statement.body, isNotNull);
6065 } 6065 }
6066 6066
6067 void test_parseForStatement_loop_iicuu() { 6067 void test_parseForStatement_loop_iicuu() {
6068 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (in t i = 0, j = count; i < j; i++, j--) {}", []); 6068 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (in t i = 0, j = count; i < j; i++, j--) {}", []);
6069 expect(statement.forKeyword, isNotNull); 6069 expect(statement.forKeyword, isNotNull);
6070 expect(statement.leftParenthesis, isNotNull); 6070 expect(statement.leftParenthesis, isNotNull);
6071 VariableDeclarationList variables = statement.variables; 6071 VariableDeclarationList variables = statement.variables;
6072 expect(variables, isNotNull); 6072 expect(variables, isNotNull);
6073 EngineTestCase.assertSizeOfList(2, variables.variables); 6073 expect(variables.variables, hasLength(2));
6074 expect(statement.initialization, isNull); 6074 expect(statement.initialization, isNull);
6075 expect(statement.leftSeparator, isNotNull); 6075 expect(statement.leftSeparator, isNotNull);
6076 expect(statement.condition, isNotNull); 6076 expect(statement.condition, isNotNull);
6077 expect(statement.rightSeparator, isNotNull); 6077 expect(statement.rightSeparator, isNotNull);
6078 EngineTestCase.assertSizeOfList(2, statement.updaters); 6078 expect(statement.updaters, hasLength(2));
6079 expect(statement.rightParenthesis, isNotNull); 6079 expect(statement.rightParenthesis, isNotNull);
6080 expect(statement.body, isNotNull); 6080 expect(statement.body, isNotNull);
6081 } 6081 }
6082 6082
6083 void test_parseForStatement_loop_iu() { 6083 void test_parseForStatement_loop_iu() {
6084 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;; i++) {}", []); 6084 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;; i++) {}", []);
6085 expect(statement.forKeyword, isNotNull); 6085 expect(statement.forKeyword, isNotNull);
6086 expect(statement.leftParenthesis, isNotNull); 6086 expect(statement.leftParenthesis, isNotNull);
6087 VariableDeclarationList variables = statement.variables; 6087 VariableDeclarationList variables = statement.variables;
6088 expect(variables, isNotNull); 6088 expect(variables, isNotNull);
6089 EngineTestCase.assertSizeOfList(1, variables.variables); 6089 expect(variables.variables, hasLength(1));
6090 expect(statement.initialization, isNull); 6090 expect(statement.initialization, isNull);
6091 expect(statement.leftSeparator, isNotNull); 6091 expect(statement.leftSeparator, isNotNull);
6092 expect(statement.condition, isNull); 6092 expect(statement.condition, isNull);
6093 expect(statement.rightSeparator, isNotNull); 6093 expect(statement.rightSeparator, isNotNull);
6094 EngineTestCase.assertSizeOfList(1, statement.updaters); 6094 expect(statement.updaters, hasLength(1));
6095 expect(statement.rightParenthesis, isNotNull); 6095 expect(statement.rightParenthesis, isNotNull);
6096 expect(statement.body, isNotNull); 6096 expect(statement.body, isNotNull);
6097 } 6097 }
6098 6098
6099 void test_parseForStatement_loop_u() { 6099 void test_parseForStatement_loop_u() {
6100 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (;; i++) {}", []); 6100 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (;; i++) {}", []);
6101 expect(statement.forKeyword, isNotNull); 6101 expect(statement.forKeyword, isNotNull);
6102 expect(statement.leftParenthesis, isNotNull); 6102 expect(statement.leftParenthesis, isNotNull);
6103 expect(statement.variables, isNull); 6103 expect(statement.variables, isNull);
6104 expect(statement.initialization, isNull); 6104 expect(statement.initialization, isNull);
6105 expect(statement.leftSeparator, isNotNull); 6105 expect(statement.leftSeparator, isNotNull);
6106 expect(statement.condition, isNull); 6106 expect(statement.condition, isNull);
6107 expect(statement.rightSeparator, isNotNull); 6107 expect(statement.rightSeparator, isNotNull);
6108 EngineTestCase.assertSizeOfList(1, statement.updaters); 6108 expect(statement.updaters, hasLength(1));
6109 expect(statement.rightParenthesis, isNotNull); 6109 expect(statement.rightParenthesis, isNotNull);
6110 expect(statement.body, isNotNull); 6110 expect(statement.body, isNotNull);
6111 } 6111 }
6112 6112
6113 void test_parseFunctionBody_block() { 6113 void test_parseFunctionBody_block() {
6114 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}"); 6114 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}");
6115 expect(functionBody.keyword, isNull); 6115 expect(functionBody.keyword, isNull);
6116 expect(functionBody.star, isNull); 6116 expect(functionBody.star, isNull);
6117 expect(functionBody.block, isNotNull); 6117 expect(functionBody.block, isNotNull);
6118 expect(functionBody.isAsynchronous, isFalse); 6118 expect(functionBody.isAsynchronous, isFalse);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
6296 expect(method.modifierKeyword, staticKeyword); 6296 expect(method.modifierKeyword, staticKeyword);
6297 expect(method.name, isNotNull); 6297 expect(method.name, isNotNull);
6298 expect(method.operatorKeyword, isNull); 6298 expect(method.operatorKeyword, isNull);
6299 expect(method.parameters, isNull); 6299 expect(method.parameters, isNull);
6300 expect(method.propertyKeyword, isNotNull); 6300 expect(method.propertyKeyword, isNotNull);
6301 expect(method.returnType, returnType); 6301 expect(method.returnType, returnType);
6302 } 6302 }
6303 6303
6304 void test_parseIdentifierList_multiple() { 6304 void test_parseIdentifierList_multiple() {
6305 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a, b, c", []); 6305 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a, b, c", []);
6306 EngineTestCase.assertSizeOfList(3, list); 6306 expect(list, hasLength(3));
6307 } 6307 }
6308 6308
6309 void test_parseIdentifierList_single() { 6309 void test_parseIdentifierList_single() {
6310 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a", []); 6310 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a", []);
6311 EngineTestCase.assertSizeOfList(1, list); 6311 expect(list, hasLength(1));
6312 } 6312 }
6313 6313
6314 void test_parseIfStatement_else_block() { 6314 void test_parseIfStatement_else_block() {
6315 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}", []); 6315 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}", []);
6316 expect(statement.ifKeyword, isNotNull); 6316 expect(statement.ifKeyword, isNotNull);
6317 expect(statement.leftParenthesis, isNotNull); 6317 expect(statement.leftParenthesis, isNotNull);
6318 expect(statement.condition, isNotNull); 6318 expect(statement.condition, isNotNull);
6319 expect(statement.rightParenthesis, isNotNull); 6319 expect(statement.rightParenthesis, isNotNull);
6320 expect(statement.thenStatement, isNotNull); 6320 expect(statement.thenStatement, isNotNull);
6321 expect(statement.elseKeyword, isNotNull); 6321 expect(statement.elseKeyword, isNotNull);
(...skipping 28 matching lines...) Expand all
6350 expect(statement.leftParenthesis, isNotNull); 6350 expect(statement.leftParenthesis, isNotNull);
6351 expect(statement.condition, isNotNull); 6351 expect(statement.condition, isNotNull);
6352 expect(statement.rightParenthesis, isNotNull); 6352 expect(statement.rightParenthesis, isNotNull);
6353 expect(statement.thenStatement, isNotNull); 6353 expect(statement.thenStatement, isNotNull);
6354 expect(statement.elseKeyword, isNull); 6354 expect(statement.elseKeyword, isNull);
6355 expect(statement.elseStatement, isNull); 6355 expect(statement.elseStatement, isNull);
6356 } 6356 }
6357 6357
6358 void test_parseImplementsClause_multiple() { 6358 void test_parseImplementsClause_multiple() {
6359 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A, B, C", []); 6359 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A, B, C", []);
6360 EngineTestCase.assertSizeOfList(3, clause.interfaces); 6360 expect(clause.interfaces, hasLength(3));
6361 expect(clause.keyword, isNotNull); 6361 expect(clause.keyword, isNotNull);
6362 } 6362 }
6363 6363
6364 void test_parseImplementsClause_single() { 6364 void test_parseImplementsClause_single() {
6365 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A", []); 6365 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A", []);
6366 EngineTestCase.assertSizeOfList(1, clause.interfaces); 6366 expect(clause.interfaces, hasLength(1));
6367 expect(clause.keyword, isNotNull); 6367 expect(clause.keyword, isNotNull);
6368 } 6368 }
6369 6369
6370 void test_parseImportDirective_deferred() { 6370 void test_parseImportDirective_deferred() {
6371 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' deferred as a;"); 6371 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' deferred as a;");
6372 expect(directive.keyword, isNotNull); 6372 expect(directive.keyword, isNotNull);
6373 expect(directive.uri, isNotNull); 6373 expect(directive.uri, isNotNull);
6374 expect(directive.deferredToken, isNotNull); 6374 expect(directive.deferredToken, isNotNull);
6375 expect(directive.asToken, isNotNull); 6375 expect(directive.asToken, isNotNull);
6376 expect(directive.prefix, isNotNull); 6376 expect(directive.prefix, isNotNull);
6377 EngineTestCase.assertSizeOfList(0, directive.combinators); 6377 expect(directive.combinators, hasLength(0));
6378 expect(directive.semicolon, isNotNull); 6378 expect(directive.semicolon, isNotNull);
6379 } 6379 }
6380 6380
6381 void test_parseImportDirective_hide() { 6381 void test_parseImportDirective_hide() {
6382 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' hide A, B;"); 6382 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' hide A, B;");
6383 expect(directive.keyword, isNotNull); 6383 expect(directive.keyword, isNotNull);
6384 expect(directive.uri, isNotNull); 6384 expect(directive.uri, isNotNull);
6385 expect(directive.deferredToken, isNull); 6385 expect(directive.deferredToken, isNull);
6386 expect(directive.asToken, isNull); 6386 expect(directive.asToken, isNull);
6387 expect(directive.prefix, isNull); 6387 expect(directive.prefix, isNull);
6388 EngineTestCase.assertSizeOfList(1, directive.combinators); 6388 expect(directive.combinators, hasLength(1));
6389 expect(directive.semicolon, isNotNull); 6389 expect(directive.semicolon, isNotNull);
6390 } 6390 }
6391 6391
6392 void test_parseImportDirective_noCombinator() { 6392 void test_parseImportDirective_noCombinator() {
6393 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart';"); 6393 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
6394 expect(directive.keyword, isNotNull); 6394 expect(directive.keyword, isNotNull);
6395 expect(directive.uri, isNotNull); 6395 expect(directive.uri, isNotNull);
6396 expect(directive.deferredToken, isNull); 6396 expect(directive.deferredToken, isNull);
6397 expect(directive.asToken, isNull); 6397 expect(directive.asToken, isNull);
6398 expect(directive.prefix, isNull); 6398 expect(directive.prefix, isNull);
6399 EngineTestCase.assertSizeOfList(0, directive.combinators); 6399 expect(directive.combinators, hasLength(0));
6400 expect(directive.semicolon, isNotNull); 6400 expect(directive.semicolon, isNotNull);
6401 } 6401 }
6402 6402
6403 void test_parseImportDirective_prefix() { 6403 void test_parseImportDirective_prefix() {
6404 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;"); 6404 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;");
6405 expect(directive.keyword, isNotNull); 6405 expect(directive.keyword, isNotNull);
6406 expect(directive.uri, isNotNull); 6406 expect(directive.uri, isNotNull);
6407 expect(directive.deferredToken, isNull); 6407 expect(directive.deferredToken, isNull);
6408 expect(directive.asToken, isNotNull); 6408 expect(directive.asToken, isNotNull);
6409 expect(directive.prefix, isNotNull); 6409 expect(directive.prefix, isNotNull);
6410 EngineTestCase.assertSizeOfList(0, directive.combinators); 6410 expect(directive.combinators, hasLength(0));
6411 expect(directive.semicolon, isNotNull); 6411 expect(directive.semicolon, isNotNull);
6412 } 6412 }
6413 6413
6414 void test_parseImportDirective_prefix_hide_show() { 6414 void test_parseImportDirective_prefix_hide_show() {
6415 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a hide A show B;"); 6415 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a hide A show B;");
6416 expect(directive.keyword, isNotNull); 6416 expect(directive.keyword, isNotNull);
6417 expect(directive.uri, isNotNull); 6417 expect(directive.uri, isNotNull);
6418 expect(directive.deferredToken, isNull); 6418 expect(directive.deferredToken, isNull);
6419 expect(directive.asToken, isNotNull); 6419 expect(directive.asToken, isNotNull);
6420 expect(directive.prefix, isNotNull); 6420 expect(directive.prefix, isNotNull);
6421 EngineTestCase.assertSizeOfList(2, directive.combinators); 6421 expect(directive.combinators, hasLength(2));
6422 expect(directive.semicolon, isNotNull); 6422 expect(directive.semicolon, isNotNull);
6423 } 6423 }
6424 6424
6425 void test_parseImportDirective_prefix_show_hide() { 6425 void test_parseImportDirective_prefix_show_hide() {
6426 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a show B hide A;"); 6426 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a show B hide A;");
6427 expect(directive.keyword, isNotNull); 6427 expect(directive.keyword, isNotNull);
6428 expect(directive.uri, isNotNull); 6428 expect(directive.uri, isNotNull);
6429 expect(directive.deferredToken, isNull); 6429 expect(directive.deferredToken, isNull);
6430 expect(directive.asToken, isNotNull); 6430 expect(directive.asToken, isNotNull);
6431 expect(directive.prefix, isNotNull); 6431 expect(directive.prefix, isNotNull);
6432 EngineTestCase.assertSizeOfList(2, directive.combinators); 6432 expect(directive.combinators, hasLength(2));
6433 expect(directive.semicolon, isNotNull); 6433 expect(directive.semicolon, isNotNull);
6434 } 6434 }
6435 6435
6436 void test_parseImportDirective_show() { 6436 void test_parseImportDirective_show() {
6437 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;"); 6437 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;");
6438 expect(directive.keyword, isNotNull); 6438 expect(directive.keyword, isNotNull);
6439 expect(directive.uri, isNotNull); 6439 expect(directive.uri, isNotNull);
6440 expect(directive.deferredToken, isNull); 6440 expect(directive.deferredToken, isNull);
6441 expect(directive.asToken, isNull); 6441 expect(directive.asToken, isNull);
6442 expect(directive.prefix, isNull); 6442 expect(directive.prefix, isNull);
6443 EngineTestCase.assertSizeOfList(1, directive.combinators); 6443 expect(directive.combinators, hasLength(1));
6444 expect(directive.semicolon, isNotNull); 6444 expect(directive.semicolon, isNotNull);
6445 } 6445 }
6446 6446
6447 void test_parseInitializedIdentifierList_type() { 6447 void test_parseInitializedIdentifierList_type() {
6448 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6448 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6449 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 6449 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
6450 TypeName type = new TypeName(new SimpleIdentifier(null), null); 6450 TypeName type = new TypeName(new SimpleIdentifier(null), null);
6451 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 6451 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
6452 commentAndMetadata(comment, []), 6452 commentAndMetadata(comment, []),
6453 staticKeyword, 6453 staticKeyword,
6454 null, 6454 null,
6455 type], "a = 1, b, c = 3;"); 6455 type], "a = 1, b, c = 3;");
6456 expect(declaration.documentationComment, comment); 6456 expect(declaration.documentationComment, comment);
6457 VariableDeclarationList fields = declaration.fields; 6457 VariableDeclarationList fields = declaration.fields;
6458 expect(fields, isNotNull); 6458 expect(fields, isNotNull);
6459 expect(fields.keyword, isNull); 6459 expect(fields.keyword, isNull);
6460 expect(fields.type, type); 6460 expect(fields.type, type);
6461 EngineTestCase.assertSizeOfList(3, fields.variables); 6461 expect(fields.variables, hasLength(3));
6462 expect(declaration.staticKeyword, staticKeyword); 6462 expect(declaration.staticKeyword, staticKeyword);
6463 expect(declaration.semicolon, isNotNull); 6463 expect(declaration.semicolon, isNotNull);
6464 } 6464 }
6465 6465
6466 void test_parseInitializedIdentifierList_var() { 6466 void test_parseInitializedIdentifierList_var() {
6467 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6467 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6468 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 6468 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
6469 Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR); 6469 Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
6470 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 6470 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
6471 commentAndMetadata(comment, []), 6471 commentAndMetadata(comment, []),
6472 staticKeyword, 6472 staticKeyword,
6473 varKeyword, 6473 varKeyword,
6474 null], "a = 1, b, c = 3;"); 6474 null], "a = 1, b, c = 3;");
6475 expect(declaration.documentationComment, comment); 6475 expect(declaration.documentationComment, comment);
6476 VariableDeclarationList fields = declaration.fields; 6476 VariableDeclarationList fields = declaration.fields;
6477 expect(fields, isNotNull); 6477 expect(fields, isNotNull);
6478 expect(fields.keyword, varKeyword); 6478 expect(fields.keyword, varKeyword);
6479 expect(fields.type, isNull); 6479 expect(fields.type, isNull);
6480 EngineTestCase.assertSizeOfList(3, fields.variables); 6480 expect(fields.variables, hasLength(3));
6481 expect(declaration.staticKeyword, staticKeyword); 6481 expect(declaration.staticKeyword, staticKeyword);
6482 expect(declaration.semicolon, isNotNull); 6482 expect(declaration.semicolon, isNotNull);
6483 } 6483 }
6484 6484
6485 void test_parseInstanceCreationExpression_qualifiedType() { 6485 void test_parseInstanceCreationExpression_qualifiedType() {
6486 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); 6486 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
6487 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()"); 6487 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()");
6488 expect(expression.keyword, token); 6488 expect(expression.keyword, token);
6489 ConstructorName name = expression.constructorName; 6489 ConstructorName name = expression.constructorName;
6490 expect(name, isNotNull); 6490 expect(name, isNotNull);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
6549 expect(identifier.name, name); 6549 expect(identifier.name, name);
6550 } 6550 }
6551 6551
6552 void test_parseListLiteral_empty_oneToken() { 6552 void test_parseListLiteral_empty_oneToken() {
6553 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6553 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6554 TypeArgumentList typeArguments = null; 6554 TypeArgumentList typeArguments = null;
6555 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]"); 6555 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]");
6556 expect(literal.constKeyword, token); 6556 expect(literal.constKeyword, token);
6557 expect(literal.typeArguments, typeArguments); 6557 expect(literal.typeArguments, typeArguments);
6558 expect(literal.leftBracket, isNotNull); 6558 expect(literal.leftBracket, isNotNull);
6559 EngineTestCase.assertSizeOfList(0, literal.elements); 6559 expect(literal.elements, hasLength(0));
6560 expect(literal.rightBracket, isNotNull); 6560 expect(literal.rightBracket, isNotNull);
6561 } 6561 }
6562 6562
6563 void test_parseListLiteral_empty_twoTokens() { 6563 void test_parseListLiteral_empty_twoTokens() {
6564 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6564 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6565 TypeArgumentList typeArguments = null; 6565 TypeArgumentList typeArguments = null;
6566 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]"); 6566 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]");
6567 expect(literal.constKeyword, token); 6567 expect(literal.constKeyword, token);
6568 expect(literal.typeArguments, typeArguments); 6568 expect(literal.typeArguments, typeArguments);
6569 expect(literal.leftBracket, isNotNull); 6569 expect(literal.leftBracket, isNotNull);
6570 EngineTestCase.assertSizeOfList(0, literal.elements); 6570 expect(literal.elements, hasLength(0));
6571 expect(literal.rightBracket, isNotNull); 6571 expect(literal.rightBracket, isNotNull);
6572 } 6572 }
6573 6573
6574 void test_parseListLiteral_multiple() { 6574 void test_parseListLiteral_multiple() {
6575 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1, 2, 3]"); 6575 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1, 2, 3]");
6576 expect(literal.constKeyword, isNull); 6576 expect(literal.constKeyword, isNull);
6577 expect(literal.typeArguments, isNull); 6577 expect(literal.typeArguments, isNull);
6578 expect(literal.leftBracket, isNotNull); 6578 expect(literal.leftBracket, isNotNull);
6579 EngineTestCase.assertSizeOfList(3, literal.elements); 6579 expect(literal.elements, hasLength(3));
6580 expect(literal.rightBracket, isNotNull); 6580 expect(literal.rightBracket, isNotNull);
6581 } 6581 }
6582 6582
6583 void test_parseListLiteral_single() { 6583 void test_parseListLiteral_single() {
6584 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]"); 6584 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]");
6585 expect(literal.constKeyword, isNull); 6585 expect(literal.constKeyword, isNull);
6586 expect(literal.typeArguments, isNull); 6586 expect(literal.typeArguments, isNull);
6587 expect(literal.leftBracket, isNotNull); 6587 expect(literal.leftBracket, isNotNull);
6588 EngineTestCase.assertSizeOfList(1, literal.elements); 6588 expect(literal.elements, hasLength(1));
6589 expect(literal.rightBracket, isNotNull); 6589 expect(literal.rightBracket, isNotNull);
6590 } 6590 }
6591 6591
6592 void test_parseListOrMapLiteral_list_noType() { 6592 void test_parseListOrMapLiteral_list_noType() {
6593 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]"); 6593 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]");
6594 expect(literal.constKeyword, isNull); 6594 expect(literal.constKeyword, isNull);
6595 expect(literal.typeArguments, isNull); 6595 expect(literal.typeArguments, isNull);
6596 expect(literal.leftBracket, isNotNull); 6596 expect(literal.leftBracket, isNotNull);
6597 EngineTestCase.assertSizeOfList(1, literal.elements); 6597 expect(literal.elements, hasLength(1));
6598 expect(literal.rightBracket, isNotNull); 6598 expect(literal.rightBracket, isNotNull);
6599 } 6599 }
6600 6600
6601 void test_parseListOrMapLiteral_list_type() { 6601 void test_parseListOrMapLiteral_list_type() {
6602 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]"); 6602 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]");
6603 expect(literal.constKeyword, isNull); 6603 expect(literal.constKeyword, isNull);
6604 expect(literal.typeArguments, isNotNull); 6604 expect(literal.typeArguments, isNotNull);
6605 expect(literal.leftBracket, isNotNull); 6605 expect(literal.leftBracket, isNotNull);
6606 EngineTestCase.assertSizeOfList(1, literal.elements); 6606 expect(literal.elements, hasLength(1));
6607 expect(literal.rightBracket, isNotNull); 6607 expect(literal.rightBracket, isNotNull);
6608 } 6608 }
6609 6609
6610 void test_parseListOrMapLiteral_map_noType() { 6610 void test_parseListOrMapLiteral_map_noType() {
6611 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}"); 6611 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
6612 expect(literal.constKeyword, isNull); 6612 expect(literal.constKeyword, isNull);
6613 expect(literal.typeArguments, isNull); 6613 expect(literal.typeArguments, isNull);
6614 expect(literal.leftBracket, isNotNull); 6614 expect(literal.leftBracket, isNotNull);
6615 EngineTestCase.assertSizeOfList(1, literal.entries); 6615 expect(literal.entries, hasLength(1));
6616 expect(literal.rightBracket, isNotNull); 6616 expect(literal.rightBracket, isNotNull);
6617 } 6617 }
6618 6618
6619 void test_parseListOrMapLiteral_map_type() { 6619 void test_parseListOrMapLiteral_map_type() {
6620 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}"); 6620 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
6621 expect(literal.constKeyword, isNull); 6621 expect(literal.constKeyword, isNull);
6622 expect(literal.typeArguments, isNotNull); 6622 expect(literal.typeArguments, isNotNull);
6623 expect(literal.leftBracket, isNotNull); 6623 expect(literal.leftBracket, isNotNull);
6624 EngineTestCase.assertSizeOfList(1, literal.entries); 6624 expect(literal.entries, hasLength(1));
6625 expect(literal.rightBracket, isNotNull); 6625 expect(literal.rightBracket, isNotNull);
6626 } 6626 }
6627 6627
6628 void test_parseLogicalAndExpression() { 6628 void test_parseLogicalAndExpression() {
6629 BinaryExpression expression = ParserTestCase.parse4("parseLogicalAndExpressi on", "x && y", []); 6629 BinaryExpression expression = ParserTestCase.parse4("parseLogicalAndExpressi on", "x && y", []);
6630 expect(expression.leftOperand, isNotNull); 6630 expect(expression.leftOperand, isNotNull);
6631 expect(expression.operator, isNotNull); 6631 expect(expression.operator, isNotNull);
6632 expect(expression.operator.type, TokenType.AMPERSAND_AMPERSAND); 6632 expect(expression.operator.type, TokenType.AMPERSAND_AMPERSAND);
6633 expect(expression.rightOperand, isNotNull); 6633 expect(expression.rightOperand, isNotNull);
6634 } 6634 }
6635 6635
6636 void test_parseLogicalOrExpression() { 6636 void test_parseLogicalOrExpression() {
6637 BinaryExpression expression = ParserTestCase.parse4("parseLogicalOrExpressio n", "x || y", []); 6637 BinaryExpression expression = ParserTestCase.parse4("parseLogicalOrExpressio n", "x || y", []);
6638 expect(expression.leftOperand, isNotNull); 6638 expect(expression.leftOperand, isNotNull);
6639 expect(expression.operator, isNotNull); 6639 expect(expression.operator, isNotNull);
6640 expect(expression.operator.type, TokenType.BAR_BAR); 6640 expect(expression.operator.type, TokenType.BAR_BAR);
6641 expect(expression.rightOperand, isNotNull); 6641 expect(expression.rightOperand, isNotNull);
6642 } 6642 }
6643 6643
6644 void test_parseMapLiteral_empty() { 6644 void test_parseMapLiteral_empty() {
6645 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6645 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6646 TypeArgumentList typeArguments = AstFactory.typeArgumentList([ 6646 TypeArgumentList typeArguments = AstFactory.typeArgumentList([
6647 AstFactory.typeName4("String", []), 6647 AstFactory.typeName4("String", []),
6648 AstFactory.typeName4("int", [])]); 6648 AstFactory.typeName4("int", [])]);
6649 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}"); 6649 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}");
6650 expect(literal.constKeyword, token); 6650 expect(literal.constKeyword, token);
6651 expect(literal.typeArguments, typeArguments); 6651 expect(literal.typeArguments, typeArguments);
6652 expect(literal.leftBracket, isNotNull); 6652 expect(literal.leftBracket, isNotNull);
6653 EngineTestCase.assertSizeOfList(0, literal.entries); 6653 expect(literal.entries, hasLength(0));
6654 expect(literal.rightBracket, isNotNull); 6654 expect(literal.rightBracket, isNotNull);
6655 } 6655 }
6656 6656
6657 void test_parseMapLiteral_multiple() { 6657 void test_parseMapLiteral_multiple() {
6658 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}"); 6658 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}");
6659 expect(literal.leftBracket, isNotNull); 6659 expect(literal.leftBracket, isNotNull);
6660 EngineTestCase.assertSizeOfList(2, literal.entries); 6660 expect(literal.entries, hasLength(2));
6661 expect(literal.rightBracket, isNotNull); 6661 expect(literal.rightBracket, isNotNull);
6662 } 6662 }
6663 6663
6664 void test_parseMapLiteral_single() { 6664 void test_parseMapLiteral_single() {
6665 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}"); 6665 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}");
6666 expect(literal.leftBracket, isNotNull); 6666 expect(literal.leftBracket, isNotNull);
6667 EngineTestCase.assertSizeOfList(1, literal.entries); 6667 expect(literal.entries, hasLength(1));
6668 expect(literal.rightBracket, isNotNull); 6668 expect(literal.rightBracket, isNotNull);
6669 } 6669 }
6670 6670
6671 void test_parseMapLiteralEntry_complex() { 6671 void test_parseMapLiteralEntry_complex() {
6672 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "2 + 2 : y", []); 6672 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "2 + 2 : y", []);
6673 expect(entry.key, isNotNull); 6673 expect(entry.key, isNotNull);
6674 expect(entry.separator, isNotNull); 6674 expect(entry.separator, isNotNull);
6675 expect(entry.value, isNotNull); 6675 expect(entry.value, isNotNull);
6676 } 6676 }
6677 6677
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
6812 void test_parseNonLabeledStatement_invokeFunctionExpression() { 6812 void test_parseNonLabeledStatement_invokeFunctionExpression() {
6813 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []); 6813 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []);
6814 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation , FunctionExpressionInvocation, statement.expression); 6814 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation , FunctionExpressionInvocation, statement.expression);
6815 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation; 6815 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation;
6816 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function); 6816 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function);
6817 FunctionExpression expression = invocation.function as FunctionExpression; 6817 FunctionExpression expression = invocation.function as FunctionExpression;
6818 expect(expression.parameters, isNotNull); 6818 expect(expression.parameters, isNotNull);
6819 expect(expression.body, isNotNull); 6819 expect(expression.body, isNotNull);
6820 ArgumentList list = invocation.argumentList; 6820 ArgumentList list = invocation.argumentList;
6821 expect(list, isNotNull); 6821 expect(list, isNotNull);
6822 EngineTestCase.assertSizeOfList(1, list.arguments); 6822 expect(list.arguments, hasLength(1));
6823 } 6823 }
6824 6824
6825 void test_parseNonLabeledStatement_null() { 6825 void test_parseNonLabeledStatement_null() {
6826 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "null;", []); 6826 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "null;", []);
6827 expect(statement.expression, isNotNull); 6827 expect(statement.expression, isNotNull);
6828 } 6828 }
6829 6829
6830 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() { 6830 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
6831 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "library.getName();", []); 6831 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "library.getName();", []);
6832 expect(statement.expression, isNotNull); 6832 expect(statement.expression, isNotNull);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
6874 expect(parameter.parameters, isNull); 6874 expect(parameter.parameters, isNull);
6875 } 6875 }
6876 6876
6877 void test_parseNormalFormalParameter_field_function_nested() { 6877 void test_parseNormalFormalParameter_field_function_nested() {
6878 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a(B b))", []); 6878 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a(B b))", []);
6879 expect(parameter.keyword, isNull); 6879 expect(parameter.keyword, isNull);
6880 expect(parameter.type, isNull); 6880 expect(parameter.type, isNull);
6881 expect(parameter.identifier, isNotNull); 6881 expect(parameter.identifier, isNotNull);
6882 FormalParameterList parameterList = parameter.parameters; 6882 FormalParameterList parameterList = parameter.parameters;
6883 expect(parameterList, isNotNull); 6883 expect(parameterList, isNotNull);
6884 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 6884 expect(parameterList.parameters, hasLength(1));
6885 } 6885 }
6886 6886
6887 void test_parseNormalFormalParameter_field_function_noNested() { 6887 void test_parseNormalFormalParameter_field_function_noNested() {
6888 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a())", []); 6888 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a())", []);
6889 expect(parameter.keyword, isNull); 6889 expect(parameter.keyword, isNull);
6890 expect(parameter.type, isNull); 6890 expect(parameter.type, isNull);
6891 expect(parameter.identifier, isNotNull); 6891 expect(parameter.identifier, isNotNull);
6892 FormalParameterList parameterList = parameter.parameters; 6892 FormalParameterList parameterList = parameter.parameters;
6893 expect(parameterList, isNotNull); 6893 expect(parameterList, isNotNull);
6894 EngineTestCase.assertSizeOfList(0, parameterList.parameters); 6894 expect(parameterList.parameters, hasLength(0));
6895 } 6895 }
6896 6896
6897 void test_parseNormalFormalParameter_field_noType() { 6897 void test_parseNormalFormalParameter_field_noType() {
6898 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a)", []); 6898 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a)", []);
6899 expect(parameter.keyword, isNull); 6899 expect(parameter.keyword, isNull);
6900 expect(parameter.type, isNull); 6900 expect(parameter.type, isNull);
6901 expect(parameter.identifier, isNotNull); 6901 expect(parameter.identifier, isNotNull);
6902 expect(parameter.parameters, isNull); 6902 expect(parameter.parameters, isNull);
6903 } 6903 }
6904 6904
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
7118 } 7118 }
7119 7119
7120 void test_parsePrimaryExpression_listLiteral_index() { 7120 void test_parsePrimaryExpression_listLiteral_index() {
7121 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[]", []); 7121 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[]", []);
7122 expect(literal, isNotNull); 7122 expect(literal, isNotNull);
7123 } 7123 }
7124 7124
7125 void test_parsePrimaryExpression_listLiteral_typed() { 7125 void test_parsePrimaryExpression_listLiteral_typed() {
7126 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]", []); 7126 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]", []);
7127 expect(literal.typeArguments, isNotNull); 7127 expect(literal.typeArguments, isNotNull);
7128 EngineTestCase.assertSizeOfList(1, literal.typeArguments.arguments); 7128 expect(literal.typeArguments.arguments, hasLength(1));
7129 } 7129 }
7130 7130
7131 void test_parsePrimaryExpression_mapLiteral() { 7131 void test_parsePrimaryExpression_mapLiteral() {
7132 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "{}", [ ]); 7132 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "{}", [ ]);
7133 expect(literal, isNotNull); 7133 expect(literal, isNotNull);
7134 } 7134 }
7135 7135
7136 void test_parsePrimaryExpression_mapLiteral_typed() { 7136 void test_parsePrimaryExpression_mapLiteral_typed() {
7137 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A, B> {}", []); 7137 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A, B> {}", []);
7138 expect(literal.typeArguments, isNotNull); 7138 expect(literal.typeArguments, isNotNull);
7139 EngineTestCase.assertSizeOfList(2, literal.typeArguments.arguments); 7139 expect(literal.typeArguments.arguments, hasLength(2));
7140 } 7140 }
7141 7141
7142 void test_parsePrimaryExpression_new() { 7142 void test_parsePrimaryExpression_new() {
7143 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "new A()", []); 7143 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "new A()", []);
7144 expect(expression, isNotNull); 7144 expect(expression, isNotNull);
7145 } 7145 }
7146 7146
7147 void test_parsePrimaryExpression_null() { 7147 void test_parsePrimaryExpression_null() {
7148 NullLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "null" , []); 7148 NullLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "null" , []);
7149 expect(literal.literal, isNotNull); 7149 expect(literal.literal, isNotNull);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
7354 } 7354 }
7355 7355
7356 void test_parseStatement_functionDeclaration() { 7356 void test_parseStatement_functionDeclaration() {
7357 // TODO(brianwilkerson) Implement more tests for this method. 7357 // TODO(brianwilkerson) Implement more tests for this method.
7358 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme nt", "int f(a, b) {};", []); 7358 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme nt", "int f(a, b) {};", []);
7359 expect(statement.functionDeclaration, isNotNull); 7359 expect(statement.functionDeclaration, isNotNull);
7360 } 7360 }
7361 7361
7362 void test_parseStatement_mulipleLabels() { 7362 void test_parseStatement_mulipleLabels() {
7363 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m: return x;", []); 7363 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m: return x;", []);
7364 EngineTestCase.assertSizeOfList(2, statement.labels); 7364 expect(statement.labels, hasLength(2));
7365 expect(statement.statement, isNotNull); 7365 expect(statement.statement, isNotNull);
7366 } 7366 }
7367 7367
7368 void test_parseStatement_noLabels() { 7368 void test_parseStatement_noLabels() {
7369 ParserTestCase.parse4("parseStatement", "return x;", []); 7369 ParserTestCase.parse4("parseStatement", "return x;", []);
7370 } 7370 }
7371 7371
7372 void test_parseStatement_singleLabel() { 7372 void test_parseStatement_singleLabel() {
7373 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: ret urn x;", []); 7373 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: ret urn x;", []);
7374 EngineTestCase.assertSizeOfList(1, statement.labels); 7374 expect(statement.labels, hasLength(1));
7375 expect(statement.statement, isNotNull); 7375 expect(statement.statement, isNotNull);
7376 } 7376 }
7377 7377
7378 void test_parseStatements_multiple() { 7378 void test_parseStatements_multiple() {
7379 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []); 7379 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []);
7380 EngineTestCase.assertSizeOfList(2, statements); 7380 expect(statements, hasLength(2));
7381 } 7381 }
7382 7382
7383 void test_parseStatements_single() { 7383 void test_parseStatements_single() {
7384 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] ); 7384 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] );
7385 EngineTestCase.assertSizeOfList(1, statements); 7385 expect(statements, hasLength(1));
7386 } 7386 }
7387 7387
7388 void test_parseStringLiteral_adjacent() { 7388 void test_parseStringLiteral_adjacent() {
7389 AdjacentStrings literal = ParserTestCase.parse4("parseStringLiteral", "'a' ' b'", []); 7389 AdjacentStrings literal = ParserTestCase.parse4("parseStringLiteral", "'a' ' b'", []);
7390 NodeList<StringLiteral> strings = literal.strings; 7390 NodeList<StringLiteral> strings = literal.strings;
7391 EngineTestCase.assertSizeOfList(2, strings); 7391 expect(strings, hasLength(2));
7392 StringLiteral firstString = strings[0]; 7392 StringLiteral firstString = strings[0];
7393 StringLiteral secondString = strings[1]; 7393 StringLiteral secondString = strings[1];
7394 expect((firstString as SimpleStringLiteral).value, "a"); 7394 expect((firstString as SimpleStringLiteral).value, "a");
7395 expect((secondString as SimpleStringLiteral).value, "b"); 7395 expect((secondString as SimpleStringLiteral).value, "b");
7396 } 7396 }
7397 7397
7398 void test_parseStringLiteral_interpolated() { 7398 void test_parseStringLiteral_interpolated() {
7399 StringInterpolation literal = ParserTestCase.parse4("parseStringLiteral", "' a \${b} c \$this d'", []); 7399 StringInterpolation literal = ParserTestCase.parse4("parseStringLiteral", "' a \${b} c \$this d'", []);
7400 NodeList<InterpolationElement> elements = literal.elements; 7400 NodeList<InterpolationElement> elements = literal.elements;
7401 EngineTestCase.assertSizeOfList(5, elements); 7401 expect(elements, hasLength(5));
7402 expect(elements[0] is InterpolationString, isTrue); 7402 expect(elements[0] is InterpolationString, isTrue);
7403 expect(elements[1] is InterpolationExpression, isTrue); 7403 expect(elements[1] is InterpolationExpression, isTrue);
7404 expect(elements[2] is InterpolationString, isTrue); 7404 expect(elements[2] is InterpolationString, isTrue);
7405 expect(elements[3] is InterpolationExpression, isTrue); 7405 expect(elements[3] is InterpolationExpression, isTrue);
7406 expect(elements[4] is InterpolationString, isTrue); 7406 expect(elements[4] is InterpolationString, isTrue);
7407 } 7407 }
7408 7408
7409 void test_parseStringLiteral_single() { 7409 void test_parseStringLiteral_single() {
7410 SimpleStringLiteral literal = ParserTestCase.parse4("parseStringLiteral", "' a'", []); 7410 SimpleStringLiteral literal = ParserTestCase.parse4("parseStringLiteral", "' a'", []);
7411 expect(literal.literal, isNotNull); 7411 expect(literal.literal, isNotNull);
(...skipping 16 matching lines...) Expand all
7428 expect(invocation.period, isNull); 7428 expect(invocation.period, isNull);
7429 } 7429 }
7430 7430
7431 void test_parseSwitchStatement_case() { 7431 void test_parseSwitchStatement_case() {
7432 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {case 1: return 'I';}", []); 7432 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {case 1: return 'I';}", []);
7433 expect(statement.keyword, isNotNull); 7433 expect(statement.keyword, isNotNull);
7434 expect(statement.leftParenthesis, isNotNull); 7434 expect(statement.leftParenthesis, isNotNull);
7435 expect(statement.expression, isNotNull); 7435 expect(statement.expression, isNotNull);
7436 expect(statement.rightParenthesis, isNotNull); 7436 expect(statement.rightParenthesis, isNotNull);
7437 expect(statement.leftBracket, isNotNull); 7437 expect(statement.leftBracket, isNotNull);
7438 EngineTestCase.assertSizeOfList(1, statement.members); 7438 expect(statement.members, hasLength(1));
7439 expect(statement.rightBracket, isNotNull); 7439 expect(statement.rightBracket, isNotNull);
7440 } 7440 }
7441 7441
7442 void test_parseSwitchStatement_empty() { 7442 void test_parseSwitchStatement_empty() {
7443 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {}", []); 7443 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {}", []);
7444 expect(statement.keyword, isNotNull); 7444 expect(statement.keyword, isNotNull);
7445 expect(statement.leftParenthesis, isNotNull); 7445 expect(statement.leftParenthesis, isNotNull);
7446 expect(statement.expression, isNotNull); 7446 expect(statement.expression, isNotNull);
7447 expect(statement.rightParenthesis, isNotNull); 7447 expect(statement.rightParenthesis, isNotNull);
7448 expect(statement.leftBracket, isNotNull); 7448 expect(statement.leftBracket, isNotNull);
7449 EngineTestCase.assertSizeOfList(0, statement.members); 7449 expect(statement.members, hasLength(0));
7450 expect(statement.rightBracket, isNotNull); 7450 expect(statement.rightBracket, isNotNull);
7451 } 7451 }
7452 7452
7453 void test_parseSwitchStatement_labeledCase() { 7453 void test_parseSwitchStatement_labeledCase() {
7454 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {l1: l2: l3: case(1):}", []); 7454 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {l1: l2: l3: case(1):}", []);
7455 expect(statement.keyword, isNotNull); 7455 expect(statement.keyword, isNotNull);
7456 expect(statement.leftParenthesis, isNotNull); 7456 expect(statement.leftParenthesis, isNotNull);
7457 expect(statement.expression, isNotNull); 7457 expect(statement.expression, isNotNull);
7458 expect(statement.rightParenthesis, isNotNull); 7458 expect(statement.rightParenthesis, isNotNull);
7459 expect(statement.leftBracket, isNotNull); 7459 expect(statement.leftBracket, isNotNull);
7460 EngineTestCase.assertSizeOfList(1, statement.members); 7460 expect(statement.members, hasLength(1));
7461 EngineTestCase.assertSizeOfList(3, statement.members[0].labels); 7461 expect(statement.members[0].labels, hasLength(3));
7462 expect(statement.rightBracket, isNotNull); 7462 expect(statement.rightBracket, isNotNull);
7463 } 7463 }
7464 7464
7465 void test_parseSwitchStatement_labeledStatementInCase() { 7465 void test_parseSwitchStatement_labeledStatementInCase() {
7466 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {case 0: f(); l1: g(); break;}", []); 7466 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {case 0: f(); l1: g(); break;}", []);
7467 expect(statement.keyword, isNotNull); 7467 expect(statement.keyword, isNotNull);
7468 expect(statement.leftParenthesis, isNotNull); 7468 expect(statement.leftParenthesis, isNotNull);
7469 expect(statement.expression, isNotNull); 7469 expect(statement.expression, isNotNull);
7470 expect(statement.rightParenthesis, isNotNull); 7470 expect(statement.rightParenthesis, isNotNull);
7471 expect(statement.leftBracket, isNotNull); 7471 expect(statement.leftBracket, isNotNull);
7472 EngineTestCase.assertSizeOfList(1, statement.members); 7472 expect(statement.members, hasLength(1));
7473 EngineTestCase.assertSizeOfList(3, statement.members[0].statements); 7473 expect(statement.members[0].statements, hasLength(3));
7474 expect(statement.rightBracket, isNotNull); 7474 expect(statement.rightBracket, isNotNull);
7475 } 7475 }
7476 7476
7477 void test_parseSymbolLiteral_builtInIdentifier() { 7477 void test_parseSymbolLiteral_builtInIdentifier() {
7478 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#dynami c.static.abstract", []); 7478 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#dynami c.static.abstract", []);
7479 expect(literal.poundSign, isNotNull); 7479 expect(literal.poundSign, isNotNull);
7480 List<Token> components = literal.components; 7480 List<Token> components = literal.components;
7481 EngineTestCase.assertLength(3, components); 7481 expect(components, hasLength(3));
7482 expect(components[0].lexeme, "dynamic"); 7482 expect(components[0].lexeme, "dynamic");
7483 expect(components[1].lexeme, "static"); 7483 expect(components[1].lexeme, "static");
7484 expect(components[2].lexeme, "abstract"); 7484 expect(components[2].lexeme, "abstract");
7485 } 7485 }
7486 7486
7487 void test_parseSymbolLiteral_multiple() { 7487 void test_parseSymbolLiteral_multiple() {
7488 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c" , []); 7488 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c" , []);
7489 expect(literal.poundSign, isNotNull); 7489 expect(literal.poundSign, isNotNull);
7490 List<Token> components = literal.components; 7490 List<Token> components = literal.components;
7491 EngineTestCase.assertLength(3, components); 7491 expect(components, hasLength(3));
7492 expect(components[0].lexeme, "a"); 7492 expect(components[0].lexeme, "a");
7493 expect(components[1].lexeme, "b"); 7493 expect(components[1].lexeme, "b");
7494 expect(components[2].lexeme, "c"); 7494 expect(components[2].lexeme, "c");
7495 } 7495 }
7496 7496
7497 void test_parseSymbolLiteral_operator() { 7497 void test_parseSymbolLiteral_operator() {
7498 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#==", [ ]); 7498 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#==", [ ]);
7499 expect(literal.poundSign, isNotNull); 7499 expect(literal.poundSign, isNotNull);
7500 List<Token> components = literal.components; 7500 List<Token> components = literal.components;
7501 EngineTestCase.assertLength(1, components); 7501 expect(components, hasLength(1));
7502 expect(components[0].lexeme, "=="); 7502 expect(components[0].lexeme, "==");
7503 } 7503 }
7504 7504
7505 void test_parseSymbolLiteral_single() { 7505 void test_parseSymbolLiteral_single() {
7506 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a", [] ); 7506 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a", [] );
7507 expect(literal.poundSign, isNotNull); 7507 expect(literal.poundSign, isNotNull);
7508 List<Token> components = literal.components; 7508 List<Token> components = literal.components;
7509 EngineTestCase.assertLength(1, components); 7509 expect(components, hasLength(1));
7510 expect(components[0].lexeme, "a"); 7510 expect(components[0].lexeme, "a");
7511 } 7511 }
7512 7512
7513 void test_parseSymbolLiteral_void() { 7513 void test_parseSymbolLiteral_void() {
7514 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#void", []); 7514 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#void", []);
7515 expect(literal.poundSign, isNotNull); 7515 expect(literal.poundSign, isNotNull);
7516 List<Token> components = literal.components; 7516 List<Token> components = literal.components;
7517 EngineTestCase.assertLength(1, components); 7517 expect(components, hasLength(1));
7518 expect(components[0].lexeme, "void"); 7518 expect(components[0].lexeme, "void");
7519 } 7519 }
7520 7520
7521 void test_parseThrowExpression() { 7521 void test_parseThrowExpression() {
7522 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpression", " throw x;", []); 7522 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpression", " throw x;", []);
7523 expect(expression.keyword, isNotNull); 7523 expect(expression.keyword, isNotNull);
7524 expect(expression.expression, isNotNull); 7524 expect(expression.expression, isNotNull);
7525 } 7525 }
7526 7526
7527 void test_parseThrowExpressionWithoutCascade() { 7527 void test_parseThrowExpressionWithoutCascade() {
7528 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpressionWith outCascade", "throw x;", []); 7528 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpressionWith outCascade", "throw x;", []);
7529 expect(expression.keyword, isNotNull); 7529 expect(expression.keyword, isNotNull);
7530 expect(expression.expression, isNotNull); 7530 expect(expression.expression, isNotNull);
7531 } 7531 }
7532 7532
7533 void test_parseTryStatement_catch() { 7533 void test_parseTryStatement_catch() {
7534 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}", []); 7534 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}", []);
7535 expect(statement.tryKeyword, isNotNull); 7535 expect(statement.tryKeyword, isNotNull);
7536 expect(statement.body, isNotNull); 7536 expect(statement.body, isNotNull);
7537 NodeList<CatchClause> catchClauses = statement.catchClauses; 7537 NodeList<CatchClause> catchClauses = statement.catchClauses;
7538 EngineTestCase.assertSizeOfList(1, catchClauses); 7538 expect(catchClauses, hasLength(1));
7539 CatchClause clause = catchClauses[0]; 7539 CatchClause clause = catchClauses[0];
7540 expect(clause.onKeyword, isNull); 7540 expect(clause.onKeyword, isNull);
7541 expect(clause.exceptionType, isNull); 7541 expect(clause.exceptionType, isNull);
7542 expect(clause.catchKeyword, isNotNull); 7542 expect(clause.catchKeyword, isNotNull);
7543 expect(clause.exceptionParameter, isNotNull); 7543 expect(clause.exceptionParameter, isNotNull);
7544 expect(clause.comma, isNull); 7544 expect(clause.comma, isNull);
7545 expect(clause.stackTraceParameter, isNull); 7545 expect(clause.stackTraceParameter, isNull);
7546 expect(clause.body, isNotNull); 7546 expect(clause.body, isNotNull);
7547 expect(statement.finallyKeyword, isNull); 7547 expect(statement.finallyKeyword, isNull);
7548 expect(statement.finallyBlock, isNull); 7548 expect(statement.finallyBlock, isNull);
7549 } 7549 }
7550 7550
7551 void test_parseTryStatement_catch_finally() { 7551 void test_parseTryStatement_catch_finally() {
7552 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e, s) {} finally {}", []); 7552 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e, s) {} finally {}", []);
7553 expect(statement.tryKeyword, isNotNull); 7553 expect(statement.tryKeyword, isNotNull);
7554 expect(statement.body, isNotNull); 7554 expect(statement.body, isNotNull);
7555 NodeList<CatchClause> catchClauses = statement.catchClauses; 7555 NodeList<CatchClause> catchClauses = statement.catchClauses;
7556 EngineTestCase.assertSizeOfList(1, catchClauses); 7556 expect(catchClauses, hasLength(1));
7557 CatchClause clause = catchClauses[0]; 7557 CatchClause clause = catchClauses[0];
7558 expect(clause.onKeyword, isNull); 7558 expect(clause.onKeyword, isNull);
7559 expect(clause.exceptionType, isNull); 7559 expect(clause.exceptionType, isNull);
7560 expect(clause.catchKeyword, isNotNull); 7560 expect(clause.catchKeyword, isNotNull);
7561 expect(clause.exceptionParameter, isNotNull); 7561 expect(clause.exceptionParameter, isNotNull);
7562 expect(clause.comma, isNotNull); 7562 expect(clause.comma, isNotNull);
7563 expect(clause.stackTraceParameter, isNotNull); 7563 expect(clause.stackTraceParameter, isNotNull);
7564 expect(clause.body, isNotNull); 7564 expect(clause.body, isNotNull);
7565 expect(statement.finallyKeyword, isNotNull); 7565 expect(statement.finallyKeyword, isNotNull);
7566 expect(statement.finallyBlock, isNotNull); 7566 expect(statement.finallyBlock, isNotNull);
7567 } 7567 }
7568 7568
7569 void test_parseTryStatement_finally() { 7569 void test_parseTryStatement_finally() {
7570 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} finally {}", []); 7570 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} finally {}", []);
7571 expect(statement.tryKeyword, isNotNull); 7571 expect(statement.tryKeyword, isNotNull);
7572 expect(statement.body, isNotNull); 7572 expect(statement.body, isNotNull);
7573 EngineTestCase.assertSizeOfList(0, statement.catchClauses); 7573 expect(statement.catchClauses, hasLength(0));
7574 expect(statement.finallyKeyword, isNotNull); 7574 expect(statement.finallyKeyword, isNotNull);
7575 expect(statement.finallyBlock, isNotNull); 7575 expect(statement.finallyBlock, isNotNull);
7576 } 7576 }
7577 7577
7578 void test_parseTryStatement_multiple() { 7578 void test_parseTryStatement_multiple() {
7579 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}", []); 7579 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}", []);
7580 expect(statement.tryKeyword, isNotNull); 7580 expect(statement.tryKeyword, isNotNull);
7581 expect(statement.body, isNotNull); 7581 expect(statement.body, isNotNull);
7582 EngineTestCase.assertSizeOfList(3, statement.catchClauses); 7582 expect(statement.catchClauses, hasLength(3));
7583 expect(statement.finallyKeyword, isNull); 7583 expect(statement.finallyKeyword, isNull);
7584 expect(statement.finallyBlock, isNull); 7584 expect(statement.finallyBlock, isNull);
7585 } 7585 }
7586 7586
7587 void test_parseTryStatement_on() { 7587 void test_parseTryStatement_on() {
7588 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error {}", []); 7588 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error {}", []);
7589 expect(statement.tryKeyword, isNotNull); 7589 expect(statement.tryKeyword, isNotNull);
7590 expect(statement.body, isNotNull); 7590 expect(statement.body, isNotNull);
7591 NodeList<CatchClause> catchClauses = statement.catchClauses; 7591 NodeList<CatchClause> catchClauses = statement.catchClauses;
7592 EngineTestCase.assertSizeOfList(1, catchClauses); 7592 expect(catchClauses, hasLength(1));
7593 CatchClause clause = catchClauses[0]; 7593 CatchClause clause = catchClauses[0];
7594 expect(clause.onKeyword, isNotNull); 7594 expect(clause.onKeyword, isNotNull);
7595 expect(clause.exceptionType, isNotNull); 7595 expect(clause.exceptionType, isNotNull);
7596 expect(clause.catchKeyword, isNull); 7596 expect(clause.catchKeyword, isNull);
7597 expect(clause.exceptionParameter, isNull); 7597 expect(clause.exceptionParameter, isNull);
7598 expect(clause.comma, isNull); 7598 expect(clause.comma, isNull);
7599 expect(clause.stackTraceParameter, isNull); 7599 expect(clause.stackTraceParameter, isNull);
7600 expect(clause.body, isNotNull); 7600 expect(clause.body, isNotNull);
7601 expect(statement.finallyKeyword, isNull); 7601 expect(statement.finallyKeyword, isNull);
7602 expect(statement.finallyBlock, isNull); 7602 expect(statement.finallyBlock, isNull);
7603 } 7603 }
7604 7604
7605 void test_parseTryStatement_on_catch() { 7605 void test_parseTryStatement_on_catch() {
7606 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}", []); 7606 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}", []);
7607 expect(statement.tryKeyword, isNotNull); 7607 expect(statement.tryKeyword, isNotNull);
7608 expect(statement.body, isNotNull); 7608 expect(statement.body, isNotNull);
7609 NodeList<CatchClause> catchClauses = statement.catchClauses; 7609 NodeList<CatchClause> catchClauses = statement.catchClauses;
7610 EngineTestCase.assertSizeOfList(1, catchClauses); 7610 expect(catchClauses, hasLength(1));
7611 CatchClause clause = catchClauses[0]; 7611 CatchClause clause = catchClauses[0];
7612 expect(clause.onKeyword, isNotNull); 7612 expect(clause.onKeyword, isNotNull);
7613 expect(clause.exceptionType, isNotNull); 7613 expect(clause.exceptionType, isNotNull);
7614 expect(clause.catchKeyword, isNotNull); 7614 expect(clause.catchKeyword, isNotNull);
7615 expect(clause.exceptionParameter, isNotNull); 7615 expect(clause.exceptionParameter, isNotNull);
7616 expect(clause.comma, isNotNull); 7616 expect(clause.comma, isNotNull);
7617 expect(clause.stackTraceParameter, isNotNull); 7617 expect(clause.stackTraceParameter, isNotNull);
7618 expect(clause.body, isNotNull); 7618 expect(clause.body, isNotNull);
7619 expect(statement.finallyKeyword, isNull); 7619 expect(statement.finallyKeyword, isNull);
7620 expect(statement.finallyBlock, isNull); 7620 expect(statement.finallyBlock, isNull);
7621 } 7621 }
7622 7622
7623 void test_parseTryStatement_on_catch_finally() { 7623 void test_parseTryStatement_on_catch_finally() {
7624 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {} finally {}", []); 7624 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {} finally {}", []);
7625 expect(statement.tryKeyword, isNotNull); 7625 expect(statement.tryKeyword, isNotNull);
7626 expect(statement.body, isNotNull); 7626 expect(statement.body, isNotNull);
7627 NodeList<CatchClause> catchClauses = statement.catchClauses; 7627 NodeList<CatchClause> catchClauses = statement.catchClauses;
7628 EngineTestCase.assertSizeOfList(1, catchClauses); 7628 expect(catchClauses, hasLength(1));
7629 CatchClause clause = catchClauses[0]; 7629 CatchClause clause = catchClauses[0];
7630 expect(clause.onKeyword, isNotNull); 7630 expect(clause.onKeyword, isNotNull);
7631 expect(clause.exceptionType, isNotNull); 7631 expect(clause.exceptionType, isNotNull);
7632 expect(clause.catchKeyword, isNotNull); 7632 expect(clause.catchKeyword, isNotNull);
7633 expect(clause.exceptionParameter, isNotNull); 7633 expect(clause.exceptionParameter, isNotNull);
7634 expect(clause.comma, isNotNull); 7634 expect(clause.comma, isNotNull);
7635 expect(clause.stackTraceParameter, isNotNull); 7635 expect(clause.stackTraceParameter, isNotNull);
7636 expect(clause.body, isNotNull); 7636 expect(clause.body, isNotNull);
7637 expect(statement.finallyKeyword, isNotNull); 7637 expect(statement.finallyKeyword, isNotNull);
7638 expect(statement.finallyBlock, isNotNull); 7638 expect(statement.finallyBlock, isNotNull);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
7694 expect(typeAlias.name, isNotNull); 7694 expect(typeAlias.name, isNotNull);
7695 expect(typeAlias.parameters, isNotNull); 7695 expect(typeAlias.parameters, isNotNull);
7696 expect(typeAlias.returnType, isNotNull); 7696 expect(typeAlias.returnType, isNotNull);
7697 expect(typeAlias.semicolon, isNotNull); 7697 expect(typeAlias.semicolon, isNotNull);
7698 expect(typeAlias.typeParameters, isNull); 7698 expect(typeAlias.typeParameters, isNull);
7699 } 7699 }
7700 7700
7701 void test_parseTypeArgumentList_multiple() { 7701 void test_parseTypeArgumentList_multiple() {
7702 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int, int, int>", []); 7702 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int, int, int>", []);
7703 expect(argumentList.leftBracket, isNotNull); 7703 expect(argumentList.leftBracket, isNotNull);
7704 EngineTestCase.assertSizeOfList(3, argumentList.arguments); 7704 expect(argumentList.arguments, hasLength(3));
7705 expect(argumentList.rightBracket, isNotNull); 7705 expect(argumentList.rightBracket, isNotNull);
7706 } 7706 }
7707 7707
7708 void test_parseTypeArgumentList_nested() { 7708 void test_parseTypeArgumentList_nested() {
7709 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<A<B>>", []); 7709 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<A<B>>", []);
7710 expect(argumentList.leftBracket, isNotNull); 7710 expect(argumentList.leftBracket, isNotNull);
7711 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 7711 expect(argumentList.arguments, hasLength(1));
7712 TypeName argument = argumentList.arguments[0]; 7712 TypeName argument = argumentList.arguments[0];
7713 expect(argument, isNotNull); 7713 expect(argument, isNotNull);
7714 TypeArgumentList innerList = argument.typeArguments; 7714 TypeArgumentList innerList = argument.typeArguments;
7715 expect(innerList, isNotNull); 7715 expect(innerList, isNotNull);
7716 EngineTestCase.assertSizeOfList(1, innerList.arguments); 7716 expect(innerList.arguments, hasLength(1));
7717 expect(argumentList.rightBracket, isNotNull); 7717 expect(argumentList.rightBracket, isNotNull);
7718 } 7718 }
7719 7719
7720 void test_parseTypeArgumentList_single() { 7720 void test_parseTypeArgumentList_single() {
7721 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int>", []); 7721 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int>", []);
7722 expect(argumentList.leftBracket, isNotNull); 7722 expect(argumentList.leftBracket, isNotNull);
7723 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 7723 expect(argumentList.arguments, hasLength(1));
7724 expect(argumentList.rightBracket, isNotNull); 7724 expect(argumentList.rightBracket, isNotNull);
7725 } 7725 }
7726 7726
7727 void test_parseTypeName_parameterized() { 7727 void test_parseTypeName_parameterized() {
7728 TypeName typeName = ParserTestCase.parse4("parseTypeName", "List<int>", []); 7728 TypeName typeName = ParserTestCase.parse4("parseTypeName", "List<int>", []);
7729 expect(typeName.name, isNotNull); 7729 expect(typeName.name, isNotNull);
7730 expect(typeName.typeArguments, isNotNull); 7730 expect(typeName.typeArguments, isNotNull);
7731 } 7731 }
7732 7732
7733 void test_parseTypeName_simple() { 7733 void test_parseTypeName_simple() {
(...skipping 13 matching lines...) Expand all
7747 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A", [ ]); 7747 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A", [ ]);
7748 expect(parameter.bound, isNull); 7748 expect(parameter.bound, isNull);
7749 expect(parameter.keyword, isNull); 7749 expect(parameter.keyword, isNull);
7750 expect(parameter.name, isNotNull); 7750 expect(parameter.name, isNotNull);
7751 } 7751 }
7752 7752
7753 void test_parseTypeParameterList_multiple() { 7753 void test_parseTypeParameterList_multiple() {
7754 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A, B extends C, D>", []); 7754 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A, B extends C, D>", []);
7755 expect(parameterList.leftBracket, isNotNull); 7755 expect(parameterList.leftBracket, isNotNull);
7756 expect(parameterList.rightBracket, isNotNull); 7756 expect(parameterList.rightBracket, isNotNull);
7757 EngineTestCase.assertSizeOfList(3, parameterList.typeParameters); 7757 expect(parameterList.typeParameters, hasLength(3));
7758 } 7758 }
7759 7759
7760 void test_parseTypeParameterList_parameterizedWithTrailingEquals() { 7760 void test_parseTypeParameterList_parameterizedWithTrailingEquals() {
7761 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A extends B<E>>=", []); 7761 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A extends B<E>>=", []);
7762 expect(parameterList.leftBracket, isNotNull); 7762 expect(parameterList.leftBracket, isNotNull);
7763 expect(parameterList.rightBracket, isNotNull); 7763 expect(parameterList.rightBracket, isNotNull);
7764 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7764 expect(parameterList.typeParameters, hasLength(1));
7765 } 7765 }
7766 7766
7767 void test_parseTypeParameterList_single() { 7767 void test_parseTypeParameterList_single() {
7768 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>", []); 7768 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>", []);
7769 expect(parameterList.leftBracket, isNotNull); 7769 expect(parameterList.leftBracket, isNotNull);
7770 expect(parameterList.rightBracket, isNotNull); 7770 expect(parameterList.rightBracket, isNotNull);
7771 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7771 expect(parameterList.typeParameters, hasLength(1));
7772 } 7772 }
7773 7773
7774 void test_parseTypeParameterList_withTrailingEquals() { 7774 void test_parseTypeParameterList_withTrailingEquals() {
7775 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>=", []); 7775 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>=", []);
7776 expect(parameterList.leftBracket, isNotNull); 7776 expect(parameterList.leftBracket, isNotNull);
7777 expect(parameterList.rightBracket, isNotNull); 7777 expect(parameterList.rightBracket, isNotNull);
7778 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7778 expect(parameterList.typeParameters, hasLength(1));
7779 } 7779 }
7780 7780
7781 void test_parseUnaryExpression_decrement_normal() { 7781 void test_parseUnaryExpression_decrement_normal() {
7782 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--x", []); 7782 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--x", []);
7783 expect(expression.operator, isNotNull); 7783 expect(expression.operator, isNotNull);
7784 expect(expression.operator.type, TokenType.MINUS_MINUS); 7784 expect(expression.operator.type, TokenType.MINUS_MINUS);
7785 expect(expression.operand, isNotNull); 7785 expect(expression.operand, isNotNull);
7786 } 7786 }
7787 7787
7788 void test_parseUnaryExpression_decrement_super() { 7788 void test_parseUnaryExpression_decrement_super() {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
7888 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a", []); 7888 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a", []);
7889 expect(declaration.name, isNotNull); 7889 expect(declaration.name, isNotNull);
7890 expect(declaration.equals, isNull); 7890 expect(declaration.equals, isNull);
7891 expect(declaration.initializer, isNull); 7891 expect(declaration.initializer, isNull);
7892 } 7892 }
7893 7893
7894 void test_parseVariableDeclarationListAfterMetadata_const_noType() { 7894 void test_parseVariableDeclarationListAfterMetadata_const_noType() {
7895 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const a") ; 7895 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const a") ;
7896 expect(declarationList.keyword, isNotNull); 7896 expect(declarationList.keyword, isNotNull);
7897 expect(declarationList.type, isNull); 7897 expect(declarationList.type, isNull);
7898 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7898 expect(declarationList.variables, hasLength(1));
7899 } 7899 }
7900 7900
7901 void test_parseVariableDeclarationListAfterMetadata_const_type() { 7901 void test_parseVariableDeclarationListAfterMetadata_const_type() {
7902 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const A a "); 7902 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const A a ");
7903 expect(declarationList.keyword, isNotNull); 7903 expect(declarationList.keyword, isNotNull);
7904 expect(declarationList.type, isNotNull); 7904 expect(declarationList.type, isNotNull);
7905 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7905 expect(declarationList.variables, hasLength(1));
7906 } 7906 }
7907 7907
7908 void test_parseVariableDeclarationListAfterMetadata_final_noType() { 7908 void test_parseVariableDeclarationListAfterMetadata_final_noType() {
7909 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final a") ; 7909 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final a") ;
7910 expect(declarationList.keyword, isNotNull); 7910 expect(declarationList.keyword, isNotNull);
7911 expect(declarationList.type, isNull); 7911 expect(declarationList.type, isNull);
7912 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7912 expect(declarationList.variables, hasLength(1));
7913 } 7913 }
7914 7914
7915 void test_parseVariableDeclarationListAfterMetadata_final_type() { 7915 void test_parseVariableDeclarationListAfterMetadata_final_type() {
7916 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final A a "); 7916 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final A a ");
7917 expect(declarationList.keyword, isNotNull); 7917 expect(declarationList.keyword, isNotNull);
7918 expect(declarationList.type, isNotNull); 7918 expect(declarationList.type, isNotNull);
7919 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7919 expect(declarationList.variables, hasLength(1));
7920 } 7920 }
7921 7921
7922 void test_parseVariableDeclarationListAfterMetadata_type_multiple() { 7922 void test_parseVariableDeclarationListAfterMetadata_type_multiple() {
7923 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a, b, c "); 7923 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a, b, c ");
7924 expect(declarationList.keyword, isNull); 7924 expect(declarationList.keyword, isNull);
7925 expect(declarationList.type, isNotNull); 7925 expect(declarationList.type, isNotNull);
7926 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7926 expect(declarationList.variables, hasLength(3));
7927 } 7927 }
7928 7928
7929 void test_parseVariableDeclarationListAfterMetadata_type_single() { 7929 void test_parseVariableDeclarationListAfterMetadata_type_single() {
7930 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a"); 7930 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a");
7931 expect(declarationList.keyword, isNull); 7931 expect(declarationList.keyword, isNull);
7932 expect(declarationList.type, isNotNull); 7932 expect(declarationList.type, isNotNull);
7933 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7933 expect(declarationList.variables, hasLength(1));
7934 } 7934 }
7935 7935
7936 void test_parseVariableDeclarationListAfterMetadata_var_multiple() { 7936 void test_parseVariableDeclarationListAfterMetadata_var_multiple() {
7937 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a, b, c"); 7937 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a, b, c");
7938 expect(declarationList.keyword, isNotNull); 7938 expect(declarationList.keyword, isNotNull);
7939 expect(declarationList.type, isNull); 7939 expect(declarationList.type, isNull);
7940 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7940 expect(declarationList.variables, hasLength(3));
7941 } 7941 }
7942 7942
7943 void test_parseVariableDeclarationListAfterMetadata_var_single() { 7943 void test_parseVariableDeclarationListAfterMetadata_var_single() {
7944 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a"); 7944 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a");
7945 expect(declarationList.keyword, isNotNull); 7945 expect(declarationList.keyword, isNotNull);
7946 expect(declarationList.type, isNull); 7946 expect(declarationList.type, isNull);
7947 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7947 expect(declarationList.variables, hasLength(1));
7948 } 7948 }
7949 7949
7950 void test_parseVariableDeclarationListAfterType_type() { 7950 void test_parseVariableDeclarationListAfterType_type() {
7951 TypeName type = new TypeName(new SimpleIdentifier(null), null); 7951 TypeName type = new TypeName(new SimpleIdentifier(null), null);
7952 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), null, type], "a "); 7952 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), null, type], "a ");
7953 expect(declarationList.keyword, isNull); 7953 expect(declarationList.keyword, isNull);
7954 expect(declarationList.type, type); 7954 expect(declarationList.type, type);
7955 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7955 expect(declarationList.variables, hasLength(1));
7956 } 7956 }
7957 7957
7958 void test_parseVariableDeclarationListAfterType_var() { 7958 void test_parseVariableDeclarationListAfterType_var() {
7959 Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR); 7959 Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
7960 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), keyword, null], "a, b, c"); 7960 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), keyword, null], "a, b, c");
7961 expect(declarationList.keyword, keyword); 7961 expect(declarationList.keyword, keyword);
7962 expect(declarationList.type, isNull); 7962 expect(declarationList.type, isNull);
7963 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7963 expect(declarationList.variables, hasLength(3));
7964 } 7964 }
7965 7965
7966 void test_parseVariableDeclarationStatementAfterMetadata_multiple() { 7966 void test_parseVariableDeclarationStatementAfterMetadata_multiple() {
7967 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x , y, z;"); 7967 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x , y, z;");
7968 expect(statement.semicolon, isNotNull); 7968 expect(statement.semicolon, isNotNull);
7969 VariableDeclarationList variableList = statement.variables; 7969 VariableDeclarationList variableList = statement.variables;
7970 expect(variableList, isNotNull); 7970 expect(variableList, isNotNull);
7971 EngineTestCase.assertSizeOfList(3, variableList.variables); 7971 expect(variableList.variables, hasLength(3));
7972 } 7972 }
7973 7973
7974 void test_parseVariableDeclarationStatementAfterMetadata_single() { 7974 void test_parseVariableDeclarationStatementAfterMetadata_single() {
7975 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x ;"); 7975 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x ;");
7976 expect(statement.semicolon, isNotNull); 7976 expect(statement.semicolon, isNotNull);
7977 VariableDeclarationList variableList = statement.variables; 7977 VariableDeclarationList variableList = statement.variables;
7978 expect(variableList, isNotNull); 7978 expect(variableList, isNotNull);
7979 EngineTestCase.assertSizeOfList(1, variableList.variables); 7979 expect(variableList.variables, hasLength(1));
7980 } 7980 }
7981 7981
7982 void test_parseWhileStatement() { 7982 void test_parseWhileStatement() {
7983 WhileStatement statement = ParserTestCase.parse4("parseWhileStatement", "whi le (x) {}", []); 7983 WhileStatement statement = ParserTestCase.parse4("parseWhileStatement", "whi le (x) {}", []);
7984 expect(statement.keyword, isNotNull); 7984 expect(statement.keyword, isNotNull);
7985 expect(statement.leftParenthesis, isNotNull); 7985 expect(statement.leftParenthesis, isNotNull);
7986 expect(statement.condition, isNotNull); 7986 expect(statement.condition, isNotNull);
7987 expect(statement.rightParenthesis, isNotNull); 7987 expect(statement.rightParenthesis, isNotNull);
7988 expect(statement.body, isNotNull); 7988 expect(statement.body, isNotNull);
7989 } 7989 }
7990 7990
7991 void test_parseWithClause_multiple() { 7991 void test_parseWithClause_multiple() {
7992 WithClause clause = ParserTestCase.parse4("parseWithClause", "with A, B, C", []); 7992 WithClause clause = ParserTestCase.parse4("parseWithClause", "with A, B, C", []);
7993 expect(clause.withKeyword, isNotNull); 7993 expect(clause.withKeyword, isNotNull);
7994 EngineTestCase.assertSizeOfList(3, clause.mixinTypes); 7994 expect(clause.mixinTypes, hasLength(3));
7995 } 7995 }
7996 7996
7997 void test_parseWithClause_single() { 7997 void test_parseWithClause_single() {
7998 WithClause clause = ParserTestCase.parse4("parseWithClause", "with M", []); 7998 WithClause clause = ParserTestCase.parse4("parseWithClause", "with M", []);
7999 expect(clause.withKeyword, isNotNull); 7999 expect(clause.withKeyword, isNotNull);
8000 EngineTestCase.assertSizeOfList(1, clause.mixinTypes); 8000 expect(clause.mixinTypes, hasLength(1));
8001 } 8001 }
8002 8002
8003 void test_parseYieldStatement_each() { 8003 void test_parseYieldStatement_each() {
8004 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld* x;", []); 8004 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld* x;", []);
8005 expect(statement.yieldKeyword, isNotNull); 8005 expect(statement.yieldKeyword, isNotNull);
8006 expect(statement.star, isNotNull); 8006 expect(statement.star, isNotNull);
8007 expect(statement.expression, isNotNull); 8007 expect(statement.expression, isNotNull);
8008 expect(statement.semicolon, isNotNull); 8008 expect(statement.semicolon, isNotNull);
8009 } 8009 }
8010 8010
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
8236 * not match those that are expected, or if the result would have be en `null` 8236 * not match those that are expected, or if the result would have be en `null`
8237 */ 8237 */
8238 CompilationUnit _parseDirectives(String source, List<ErrorCode> errorCodes) { 8238 CompilationUnit _parseDirectives(String source, List<ErrorCode> errorCodes) {
8239 GatheringErrorListener listener = new GatheringErrorListener(); 8239 GatheringErrorListener listener = new GatheringErrorListener();
8240 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 8240 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
8241 listener.setLineInfo(new TestSource(), scanner.lineStarts); 8241 listener.setLineInfo(new TestSource(), scanner.lineStarts);
8242 Token token = scanner.tokenize(); 8242 Token token = scanner.tokenize();
8243 Parser parser = new Parser(null, listener); 8243 Parser parser = new Parser(null, listener);
8244 CompilationUnit unit = parser.parseDirectives(token); 8244 CompilationUnit unit = parser.parseDirectives(token);
8245 expect(unit, isNotNull); 8245 expect(unit, isNotNull);
8246 EngineTestCase.assertSizeOfList(0, unit.declarations); 8246 expect(unit.declarations, hasLength(0));
8247 listener.assertErrorsWithCodes(errorCodes); 8247 listener.assertErrorsWithCodes(errorCodes);
8248 return unit; 8248 return unit;
8249 } 8249 }
8250 8250
8251 /** 8251 /**
8252 * Invoke a "skip" method in [Parser]. The method is assumed to take a token a s it's 8252 * Invoke a "skip" method in [Parser]. The method is assumed to take a token a s it's
8253 * parameter and is given the first token in the scanned source. 8253 * parameter and is given the first token in the scanned source.
8254 * 8254 *
8255 * @param methodName the name of the method that should be invoked 8255 * @param methodName the name of the method that should be invoked
8256 * @param source the source to be processed by the method 8256 * @param source the source to be processed by the method
(...skipping 19 matching lines...) Expand all
8276 main() { 8276 main() {
8277 groupSep = ' | '; 8277 groupSep = ' | ';
8278 runReflectiveTests(ComplexParserTest); 8278 runReflectiveTests(ComplexParserTest);
8279 runReflectiveTests(ErrorParserTest); 8279 runReflectiveTests(ErrorParserTest);
8280 runReflectiveTests(IncrementalParserTest); 8280 runReflectiveTests(IncrementalParserTest);
8281 runReflectiveTests(NonErrorParserTest); 8281 runReflectiveTests(NonErrorParserTest);
8282 runReflectiveTests(RecoveryParserTest); 8282 runReflectiveTests(RecoveryParserTest);
8283 runReflectiveTests(ResolutionCopierTest); 8283 runReflectiveTests(ResolutionCopierTest);
8284 runReflectiveTests(SimpleParserTest); 8284 runReflectiveTests(SimpleParserTest);
8285 } 8285 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/engine_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698