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

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

Issue 685573002: Inline JUnitTestCase 'assert' methods. (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/java_core.dart';
11 import 'package:analyzer/src/generated/java_junit.dart';
12 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
13 import 'package:analyzer/src/generated/source.dart' show Source; 11 import 'package:analyzer/src/generated/source.dart' show Source;
14 import 'package:analyzer/src/generated/scanner.dart'; 12 import 'package:analyzer/src/generated/scanner.dart';
15 import 'package:analyzer/src/generated/ast.dart'; 13 import 'package:analyzer/src/generated/ast.dart';
16 import 'package:analyzer/src/generated/parser.dart'; 14 import 'package:analyzer/src/generated/parser.dart';
17 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
18 import 'package:analyzer/src/generated/utilities_dart.dart'; 16 import 'package:analyzer/src/generated/utilities_dart.dart';
19 import 'package:unittest/unittest.dart' as _ut; 17 import 'package:unittest/unittest.dart';
20 import 'test_support.dart'; 18 import 'test_support.dart';
21 import 'package:analyzer/src/generated/testing/ast_factory.dart'; 19 import 'package:analyzer/src/generated/testing/ast_factory.dart';
22 import 'package:analyzer/src/generated/testing/element_factory.dart'; 20 import 'package:analyzer/src/generated/testing/element_factory.dart';
23 import 'package:analyzer/src/generated/testing/token_factory.dart'; 21 import 'package:analyzer/src/generated/testing/token_factory.dart';
24 22
25 import '../reflective_tests.dart'; 23 import '../reflective_tests.dart';
26 24
27 25
28 class AnalysisErrorListener_SimpleParserTest_computeStringValue implements Analy sisErrorListener { 26 class AnalysisErrorListener_SimpleParserTest_computeStringValue implements Analy sisErrorListener {
29 @override 27 @override
30 void onError(AnalysisError event) { 28 void onError(AnalysisError event) {
31 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})"); 29 fail("Unexpected compilation error: ${event.message} (${event.offset}, ${eve nt.length})");
32 } 30 }
33 } 31 }
34 32
35 /** 33 /**
36 * Instances of the class `AstValidator` are used to validate the correct constr uction of an 34 * Instances of the class `AstValidator` are used to validate the correct constr uction of an
37 * AST structure. 35 * AST structure.
38 */ 36 */
39 class AstValidator extends UnifyingAstVisitor<Object> { 37 class AstValidator extends UnifyingAstVisitor<Object> {
40 /** 38 /**
41 * A list containing the errors found while traversing the AST structure. 39 * A list containing the errors found while traversing the AST structure.
42 */ 40 */
43 List<String> _errors = new List<String>(); 41 List<String> _errors = new List<String>();
44 42
45 /** 43 /**
46 * Assert that no errors were found while traversing any of the AST structures that have been 44 * Assert that no errors were found while traversing any of the AST structures that have been
47 * visited. 45 * visited.
48 */ 46 */
49 void assertValid() { 47 void assertValid() {
50 if (!_errors.isEmpty) { 48 if (!_errors.isEmpty) {
51 StringBuffer buffer = new StringBuffer(); 49 StringBuffer buffer = new StringBuffer();
52 buffer.write("Invalid AST structure:"); 50 buffer.write("Invalid AST structure:");
53 for (String message in _errors) { 51 for (String message in _errors) {
54 buffer.write("\r\n "); 52 buffer.write("\r\n ");
55 buffer.write(message); 53 buffer.write(message);
56 } 54 }
57 JUnitTestCase.fail(buffer.toString()); 55 fail(buffer.toString());
58 } 56 }
59 } 57 }
60 58
61 @override 59 @override
62 Object visitNode(AstNode node) { 60 Object visitNode(AstNode node) {
63 _validate(node); 61 _validate(node);
64 return super.visitNode(node); 62 return super.visitNode(node);
65 } 63 }
66 64
67 /** 65 /**
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 137 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
140 } 138 }
141 139
142 void test_additiveExpression_super() { 140 void test_additiveExpression_super() {
143 BinaryExpression expression = ParserTestCase.parseExpression("super + y - z" , []); 141 BinaryExpression expression = ParserTestCase.parseExpression("super + y - z" , []);
144 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 142 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
145 } 143 }
146 144
147 void test_assignableExpression_arguments_normal_chain() { 145 void test_assignableExpression_arguments_normal_chain() {
148 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []); 146 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []);
149 JUnitTestCase.assertEquals("f", propertyAccess1.propertyName.name); 147 expect(propertyAccess1.propertyName.name, "f");
150 // 148 //
151 // a(b)(c).d(e) 149 // a(b)(c).d(e)
152 // 150 //
153 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, propertyAccess1.target); 151 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, propertyAccess1.target);
154 JUnitTestCase.assertEquals("d", invocation2.methodName.name); 152 expect(invocation2.methodName.name, "d");
155 ArgumentList argumentList2 = invocation2.argumentList; 153 ArgumentList argumentList2 = invocation2.argumentList;
156 JUnitTestCase.assertNotNull(argumentList2); 154 expect(argumentList2, isNotNull);
157 EngineTestCase.assertSizeOfList(1, argumentList2.arguments); 155 EngineTestCase.assertSizeOfList(1, argumentList2.arguments);
158 // 156 //
159 // a(b)(c) 157 // a(b)(c)
160 // 158 //
161 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);
162 ArgumentList argumentList3 = invocation3.argumentList; 160 ArgumentList argumentList3 = invocation3.argumentList;
163 JUnitTestCase.assertNotNull(argumentList3); 161 expect(argumentList3, isNotNull);
164 EngineTestCase.assertSizeOfList(1, argumentList3.arguments); 162 EngineTestCase.assertSizeOfList(1, argumentList3.arguments);
165 // 163 //
166 // a(b) 164 // a(b)
167 // 165 //
168 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, invocation3.function); 166 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, invocation3.function);
169 JUnitTestCase.assertEquals("a", invocation4.methodName.name); 167 expect(invocation4.methodName.name, "a");
170 ArgumentList argumentList4 = invocation4.argumentList; 168 ArgumentList argumentList4 = invocation4.argumentList;
171 JUnitTestCase.assertNotNull(argumentList4); 169 expect(argumentList4, isNotNull);
172 EngineTestCase.assertSizeOfList(1, argumentList4.arguments); 170 EngineTestCase.assertSizeOfList(1, argumentList4.arguments);
173 } 171 }
174 172
175 void test_assignmentExpression_compound() { 173 void test_assignmentExpression_compound() {
176 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []); 174 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []);
177 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide); 175 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide);
178 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assign mentExpression, expression.rightHandSide); 176 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assign mentExpression, expression.rightHandSide);
179 } 177 }
180 178
181 void test_assignmentExpression_indexExpression() { 179 void test_assignmentExpression_indexExpression() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 255 }
258 256
259 void test_cascade_withAssignment() { 257 void test_cascade_withAssignment() {
260 CascadeExpression cascade = ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;", []); 258 CascadeExpression cascade = ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;", []);
261 Expression target = cascade.target; 259 Expression target = cascade.target;
262 for (Expression section in cascade.cascadeSections) { 260 for (Expression section in cascade.cascadeSections) {
263 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assi gnmentExpression, section); 261 EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, Assi gnmentExpression, section);
264 Expression lhs = (section as AssignmentExpression).leftHandSide; 262 Expression lhs = (section as AssignmentExpression).leftHandSide;
265 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpr ession, lhs); 263 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpr ession, lhs);
266 IndexExpression index = lhs as IndexExpression; 264 IndexExpression index = lhs as IndexExpression;
267 JUnitTestCase.assertTrue(index.isCascaded); 265 expect(index.isCascaded, isTrue);
268 JUnitTestCase.assertSame(target, index.realTarget); 266 expect(index.realTarget, same(target));
269 } 267 }
270 } 268 }
271 269
272 void test_conditionalExpression_precedence_logicalOrExpression() { 270 void test_conditionalExpression_precedence_logicalOrExpression() {
273 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []); 271 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []);
274 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.condition); 272 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.condition);
275 } 273 }
276 274
277 void test_constructor_initializer_withParenthesizedExpression() { 275 void test_constructor_initializer_withParenthesizedExpression() {
278 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 276 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 * The class `ErrorParserTest` defines parser tests that test the parsing of cod e to ensure 393 * The class `ErrorParserTest` defines parser tests that test the parsing of cod e to ensure
396 * that errors are correctly reported, and in some cases, not reported. 394 * that errors are correctly reported, and in some cases, not reported.
397 */ 395 */
398 class ErrorParserTest extends ParserTestCase { 396 class ErrorParserTest extends ParserTestCase {
399 void fail_expectedListOrMapLiteral() { 397 void fail_expectedListOrMapLiteral() {
400 // It isn't clear that this test can ever pass. The parser is currently crea te a synthetic list 398 // It isn't clear that this test can ever pass. The parser is currently crea te a synthetic list
401 // literal in this case, but isSynthetic() isn't overridden for ListLiteral. The problem is that 399 // literal in this case, but isSynthetic() isn't overridden for ListLiteral. The problem is that
402 // the synthetic list literals that are being created are not always zero le ngth (because they 400 // the synthetic list literals that are being created are not always zero le ngth (because they
403 // could have type parameters), which violates the contract of isSynthetic() . 401 // could have type parameters), which violates the contract of isSynthetic() .
404 TypedLiteral literal = ParserTestCase.parse3("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); 402 TypedLiteral literal = ParserTestCase.parse3("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
405 JUnitTestCase.assertTrue(literal.isSynthetic); 403 expect(literal.isSynthetic, isTrue);
406 } 404 }
407 405
408 void fail_illegalAssignmentToNonAssignable_superAssigned() { 406 void fail_illegalAssignmentToNonAssignable_superAssigned() {
409 // TODO(brianwilkerson) When this test starts to pass, remove the test 407 // TODO(brianwilkerson) When this test starts to pass, remove the test
410 // test_illegalAssignmentToNonAssignable_superAssigned. 408 // test_illegalAssignmentToNonAssignable_superAssigned.
411 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN MENT_TO_NON_ASSIGNABLE]); 409 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN MENT_TO_NON_ASSIGNABLE]);
412 } 410 }
413 411
414 void fail_invalidCommentReference__new_nonIdentifier() { 412 void fail_invalidCommentReference__new_nonIdentifier() {
415 // This test fails because the method parseCommentReference returns null. 413 // This test fails because the method parseCommentReference returns null.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 void test_deprecatedClassTypeAlias() { 646 void test_deprecatedClassTypeAlias() {
649 ParserTestCase.parseCompilationUnit("typedef C = S with M;", [ParserErrorCod e.DEPRECATED_CLASS_TYPE_ALIAS]); 647 ParserTestCase.parseCompilationUnit("typedef C = S with M;", [ParserErrorCod e.DEPRECATED_CLASS_TYPE_ALIAS]);
650 } 648 }
651 649
652 void test_deprecatedClassTypeAlias_withGeneric() { 650 void test_deprecatedClassTypeAlias_withGeneric() {
653 ParserTestCase.parseCompilationUnit("typedef C<T> = S<T> with M;", [ParserEr rorCode.DEPRECATED_CLASS_TYPE_ALIAS]); 651 ParserTestCase.parseCompilationUnit("typedef C<T> = S<T> with M;", [ParserEr rorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
654 } 652 }
655 653
656 void test_directiveAfterDeclaration_classBeforeDirective() { 654 void test_directiveAfterDeclaration_classBeforeDirective() {
657 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); 655 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
658 JUnitTestCase.assertNotNull(unit); 656 expect(unit, isNotNull);
659 } 657 }
660 658
661 void test_directiveAfterDeclaration_classBetweenDirectives() { 659 void test_directiveAfterDeclaration_classBetweenDirectives() {
662 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); 660 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
663 JUnitTestCase.assertNotNull(unit); 661 expect(unit, isNotNull);
664 } 662 }
665 663
666 void test_duplicatedModifier_const() { 664 void test_duplicatedModifier_const() {
667 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 665 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
668 } 666 }
669 667
670 void test_duplicatedModifier_external() { 668 void test_duplicatedModifier_external() {
671 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]); 669 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]);
672 } 670 }
673 671
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 743
746 void test_expectedInterpolationIdentifier_emptyString() { 744 void test_expectedInterpolationIdentifier_emptyString() {
747 // The scanner inserts an empty string token between the two $'s; we need to make sure that the 745 // The scanner inserts an empty string token between the two $'s; we need to make sure that the
748 // MISSING_IDENTIFIER error that is generated has a nonzero width so that it will show up in 746 // MISSING_IDENTIFIER error that is generated has a nonzero width so that it will show up in
749 // the editor UI. 747 // the editor UI.
750 ParserTestCase.parse2("parseStringLiteral", <Object> [], "'\$\$foo'", [new A nalysisError.con2(null, 2, 1, ParserErrorCode.MISSING_IDENTIFIER, [])]); 748 ParserTestCase.parse2("parseStringLiteral", <Object> [], "'\$\$foo'", [new A nalysisError.con2(null, 2, 1, ParserErrorCode.MISSING_IDENTIFIER, [])]);
751 } 749 }
752 750
753 void test_expectedStringLiteral() { 751 void test_expectedStringLiteral() {
754 StringLiteral expression = ParserTestCase.parse4("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]); 752 StringLiteral expression = ParserTestCase.parse4("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]);
755 JUnitTestCase.assertTrue(expression.isSynthetic); 753 expect(expression.isSynthetic, isTrue);
756 } 754 }
757 755
758 void test_expectedToken_commaMissingInArgumentList() { 756 void test_expectedToken_commaMissingInArgumentList() {
759 ParserTestCase.parse4("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]); 757 ParserTestCase.parse4("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]);
760 } 758 }
761 759
762 void test_expectedToken_parseStatement_afterVoid() { 760 void test_expectedToken_parseStatement_afterVoid() {
763 ParserTestCase.parseStatement("void}", [ 761 ParserTestCase.parseStatement("void}", [
764 ParserErrorCode.EXPECTED_TOKEN, 762 ParserErrorCode.EXPECTED_TOKEN,
765 ParserErrorCode.MISSING_IDENTIFIER]); 763 ParserErrorCode.MISSING_IDENTIFIER]);
766 } 764 }
767 765
768 void test_expectedToken_semicolonAfterClass() { 766 void test_expectedToken_semicolonAfterClass() {
769 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS); 767 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
770 ParserTestCase.parse3("parseClassTypeAlias", <Object> [emptyCommentAndMetada ta(), null, token], "A = B with C", [ParserErrorCode.EXPECTED_TOKEN]); 768 ParserTestCase.parse3("parseClassTypeAlias", <Object> [emptyCommentAndMetada ta(), null, token], "A = B with C", [ParserErrorCode.EXPECTED_TOKEN]);
771 } 769 }
772 770
773 void test_expectedToken_semicolonMissingAfterExport() { 771 void test_expectedToken_semicolonMissingAfterExport() {
774 CompilationUnit unit = ParserTestCase.parseCompilationUnit("export '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]); 772 CompilationUnit unit = ParserTestCase.parseCompilationUnit("export '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
775 ExportDirective directive = unit.directives[0] as ExportDirective; 773 ExportDirective directive = unit.directives[0] as ExportDirective;
776 Token semicolon = directive.semicolon; 774 Token semicolon = directive.semicolon;
777 JUnitTestCase.assertNotNull(semicolon); 775 expect(semicolon, isNotNull);
778 JUnitTestCase.assertTrue(semicolon.isSynthetic); 776 expect(semicolon.isSynthetic, isTrue);
779 } 777 }
780 778
781 void test_expectedToken_semicolonMissingAfterExpression() { 779 void test_expectedToken_semicolonMissingAfterExpression() {
782 ParserTestCase.parseStatement("x", [ParserErrorCode.EXPECTED_TOKEN]); 780 ParserTestCase.parseStatement("x", [ParserErrorCode.EXPECTED_TOKEN]);
783 } 781 }
784 782
785 void test_expectedToken_semicolonMissingAfterImport() { 783 void test_expectedToken_semicolonMissingAfterImport() {
786 CompilationUnit unit = ParserTestCase.parseCompilationUnit("import '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]); 784 CompilationUnit unit = ParserTestCase.parseCompilationUnit("import '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
787 ImportDirective directive = unit.directives[0] as ImportDirective; 785 ImportDirective directive = unit.directives[0] as ImportDirective;
788 Token semicolon = directive.semicolon; 786 Token semicolon = directive.semicolon;
789 JUnitTestCase.assertNotNull(semicolon); 787 expect(semicolon, isNotNull);
790 JUnitTestCase.assertTrue(semicolon.isSynthetic); 788 expect(semicolon.isSynthetic, isTrue);
791 } 789 }
792 790
793 void test_expectedToken_whileMissingInDoStatement() { 791 void test_expectedToken_whileMissingInDoStatement() {
794 ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN] ); 792 ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN] );
795 } 793 }
796 794
797 void test_expectedTypeName_is() { 795 void test_expectedTypeName_is() {
798 ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]) ; 796 ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]) ;
799 } 797 }
800 798
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 ParserErrorCode.INVALID_UNICODE_ESCAPE, 1042 ParserErrorCode.INVALID_UNICODE_ESCAPE,
1045 ParserErrorCode.INVALID_CODE_POINT]); 1043 ParserErrorCode.INVALID_CODE_POINT]);
1046 } 1044 }
1047 1045
1048 void test_libraryDirectiveNotFirst() { 1046 void test_libraryDirectiveNotFirst() {
1049 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 1047 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
1050 } 1048 }
1051 1049
1052 void test_libraryDirectiveNotFirst_afterPart() { 1050 void test_libraryDirectiveNotFirst_afterPart() {
1053 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 1051 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
1054 JUnitTestCase.assertNotNull(unit); 1052 expect(unit, isNotNull);
1055 } 1053 }
1056 1054
1057 void test_localFunctionDeclarationModifier_abstract() { 1055 void test_localFunctionDeclarationModifier_abstract() {
1058 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]); 1056 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]);
1059 } 1057 }
1060 1058
1061 void test_localFunctionDeclarationModifier_external() { 1059 void test_localFunctionDeclarationModifier_external() {
1062 ParserTestCase.parseStatement("external f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]); 1060 ParserTestCase.parseStatement("external f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]);
1063 } 1061 }
1064 1062
(...skipping 16 matching lines...) Expand all
1081 void test_missingAssignableSelector_prefix_plusPlus_literal() { 1079 void test_missingAssignableSelector_prefix_plusPlus_literal() {
1082 ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]); 1080 ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]);
1083 } 1081 }
1084 1082
1085 void test_missingAssignableSelector_selector() { 1083 void test_missingAssignableSelector_selector() {
1086 ParserTestCase.parseExpression("x(y)(z).a++", []); 1084 ParserTestCase.parseExpression("x(y)(z).a++", []);
1087 } 1085 }
1088 1086
1089 void test_missingAssignableSelector_superPrimaryExpression() { 1087 void test_missingAssignableSelector_superPrimaryExpression() {
1090 SuperExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]); 1088 SuperExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
1091 JUnitTestCase.assertNotNull(expression.keyword); 1089 expect(expression.keyword, isNotNull);
1092 } 1090 }
1093 1091
1094 void test_missingAssignableSelector_superPropertyAccessAssigned() { 1092 void test_missingAssignableSelector_superPropertyAccessAssigned() {
1095 ParserTestCase.parseExpression("super.x = x;", []); 1093 ParserTestCase.parseExpression("super.x = x;", []);
1096 } 1094 }
1097 1095
1098 void test_missingCatchOrFinally() { 1096 void test_missingCatchOrFinally() {
1099 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]); 1097 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
1100 JUnitTestCase.assertNotNull(statement); 1098 expect(statement, isNotNull);
1101 } 1099 }
1102 1100
1103 void test_missingClassBody() { 1101 void test_missingClassBody() {
1104 ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.M ISSING_CLASS_BODY]); 1102 ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.M ISSING_CLASS_BODY]);
1105 } 1103 }
1106 1104
1107 void test_missingConstFinalVarOrType_static() { 1105 void test_missingConstFinalVarOrType_static() {
1108 ParserTestCase.parseCompilationUnit("class A { static f; }", [ParserErrorCod e.MISSING_CONST_FINAL_VAR_OR_TYPE]); 1106 ParserTestCase.parseCompilationUnit("class A { static f; }", [ParserErrorCod e.MISSING_CONST_FINAL_VAR_OR_TYPE]);
1109 } 1107 }
1110 1108
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 void test_missingIdentifier_inSymbol_afterPeriod() { 1175 void test_missingIdentifier_inSymbol_afterPeriod() {
1178 ParserTestCase.parse4("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_ IDENTIFIER]); 1176 ParserTestCase.parse4("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_ IDENTIFIER]);
1179 } 1177 }
1180 1178
1181 void test_missingIdentifier_inSymbol_first() { 1179 void test_missingIdentifier_inSymbol_first() {
1182 ParserTestCase.parse4("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_ID ENTIFIER]); 1180 ParserTestCase.parse4("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_ID ENTIFIER]);
1183 } 1181 }
1184 1182
1185 void test_missingIdentifier_number() { 1183 void test_missingIdentifier_number() {
1186 SimpleIdentifier expression = ParserTestCase.parse4("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]); 1184 SimpleIdentifier expression = ParserTestCase.parse4("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]);
1187 JUnitTestCase.assertTrue(expression.isSynthetic); 1185 expect(expression.isSynthetic, isTrue);
1188 } 1186 }
1189 1187
1190 void test_missingKeywordOperator() { 1188 void test_missingKeywordOperator() {
1191 ParserTestCase.parse3("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]); 1189 ParserTestCase.parse3("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
1192 } 1190 }
1193 1191
1194 void test_missingKeywordOperator_parseClassMember() { 1192 void test_missingKeywordOperator_parseClassMember() {
1195 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "+() {}", [ParserE rrorCode.MISSING_KEYWORD_OPERATOR]); 1193 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "+() {}", [ParserE rrorCode.MISSING_KEYWORD_OPERATOR]);
1196 } 1194 }
1197 1195
1198 void test_missingKeywordOperator_parseClassMember_afterTypeName() { 1196 void test_missingKeywordOperator_parseClassMember_afterTypeName() {
1199 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "int +() {}", [Par serErrorCode.MISSING_KEYWORD_OPERATOR]); 1197 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "int +() {}", [Par serErrorCode.MISSING_KEYWORD_OPERATOR]);
1200 } 1198 }
1201 1199
1202 void test_missingKeywordOperator_parseClassMember_afterVoid() { 1200 void test_missingKeywordOperator_parseClassMember_afterVoid() {
1203 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void +() {}", [Pa rserErrorCode.MISSING_KEYWORD_OPERATOR]); 1201 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void +() {}", [Pa rserErrorCode.MISSING_KEYWORD_OPERATOR]);
1204 } 1202 }
1205 1203
1206 void test_missingNameInLibraryDirective() { 1204 void test_missingNameInLibraryDirective() {
1207 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [Pars erErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]); 1205 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [Pars erErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
1208 JUnitTestCase.assertNotNull(unit); 1206 expect(unit, isNotNull);
1209 } 1207 }
1210 1208
1211 void test_missingNameInPartOfDirective() { 1209 void test_missingNameInPartOfDirective() {
1212 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [Pars erErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]); 1210 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [Pars erErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]);
1213 JUnitTestCase.assertNotNull(unit); 1211 expect(unit, isNotNull);
1214 } 1212 }
1215 1213
1216 void test_missingPrefixInDeferredImport() { 1214 void test_missingPrefixInDeferredImport() {
1217 ParserTestCase.parseCompilationUnit("import 'foo.dart' deferred;", [ParserEr rorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT]); 1215 ParserTestCase.parseCompilationUnit("import 'foo.dart' deferred;", [ParserEr rorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT]);
1218 } 1216 }
1219 1217
1220 void test_missingStartAfterSync() { 1218 void test_missingStartAfterSync() {
1221 ParserTestCase.parse3("parseFunctionBody", <Object> [false, null, false], "s ync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]); 1219 ParserTestCase.parse3("parseFunctionBody", <Object> [false, null, false], "s ync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
1222 } 1220 }
1223 1221
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 void test_nonConstructorFactory_field() { 1302 void test_nonConstructorFactory_field() {
1305 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 1303 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
1306 } 1304 }
1307 1305
1308 void test_nonConstructorFactory_method() { 1306 void test_nonConstructorFactory_method() {
1309 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 1307 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
1310 } 1308 }
1311 1309
1312 void test_nonIdentifierLibraryName_library() { 1310 void test_nonIdentifierLibraryName_library() {
1313 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 1311 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
1314 JUnitTestCase.assertNotNull(unit); 1312 expect(unit, isNotNull);
1315 } 1313 }
1316 1314
1317 void test_nonIdentifierLibraryName_partOf() { 1315 void test_nonIdentifierLibraryName_partOf() {
1318 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 1316 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
1319 JUnitTestCase.assertNotNull(unit); 1317 expect(unit, isNotNull);
1320 } 1318 }
1321 1319
1322 void test_nonPartOfDirectiveInPart_after() { 1320 void test_nonPartOfDirectiveInPart_after() {
1323 ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]); 1321 ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
1324 } 1322 }
1325 1323
1326 void test_nonPartOfDirectiveInPart_before() { 1324 void test_nonPartOfDirectiveInPart_before() {
1327 ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]); 1325 ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
1328 } 1326 }
1329 1327
1330 void test_nonUserDefinableOperator() { 1328 void test_nonUserDefinableOperator() {
1331 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]); 1329 ParserTestCase.parse3("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
1332 } 1330 }
1333 1331
1334 void test_optionalAfterNormalParameters_named() { 1332 void test_optionalAfterNormalParameters_named() {
1335 ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 1333 ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
1336 } 1334 }
1337 1335
1338 void test_optionalAfterNormalParameters_positional() { 1336 void test_optionalAfterNormalParameters_positional() {
1339 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 1337 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
1340 } 1338 }
1341 1339
1342 void test_parseCascadeSection_missingIdentifier() { 1340 void test_parseCascadeSection_missingIdentifier() {
1343 MethodInvocation methodInvocation = ParserTestCase.parse4("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]); 1341 MethodInvocation methodInvocation = ParserTestCase.parse4("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]);
1344 JUnitTestCase.assertNull(methodInvocation.target); 1342 expect(methodInvocation.target, isNull);
1345 JUnitTestCase.assertEquals("", methodInvocation.methodName.name); 1343 expect(methodInvocation.methodName.name, "");
1346 EngineTestCase.assertSizeOfList(0, methodInvocation.argumentList.arguments); 1344 EngineTestCase.assertSizeOfList(0, methodInvocation.argumentList.arguments);
1347 } 1345 }
1348 1346
1349 void test_positionalAfterNamedArgument() { 1347 void test_positionalAfterNamedArgument() {
1350 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]);
1351 } 1349 }
1352 1350
1353 void test_positionalParameterOutsideGroup() { 1351 void test_positionalParameterOutsideGroup() {
1354 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]);
1355 } 1353 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 ParserTestCase.parse3("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ; 1456 ParserTestCase.parse3("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ;
1459 } 1457 }
1460 1458
1461 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() { 1459 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
1462 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]); 1460 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]);
1463 } 1461 }
1464 1462
1465 void test_useOfUnaryPlusOperator() { 1463 void test_useOfUnaryPlusOperator() {
1466 SimpleIdentifier expression = ParserTestCase.parse4("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]); 1464 SimpleIdentifier expression = ParserTestCase.parse4("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
1467 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression); 1465 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression);
1468 JUnitTestCase.assertTrue(expression.isSynthetic); 1466 expect(expression.isSynthetic, isTrue);
1469 } 1467 }
1470 1468
1471 void test_varAndType_field() { 1469 void test_varAndType_field() {
1472 ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCo de.VAR_AND_TYPE]); 1470 ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCo de.VAR_AND_TYPE]);
1473 } 1471 }
1474 1472
1475 void test_varAndType_topLevelVariable() { 1473 void test_varAndType_topLevelVariable() {
1476 ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_T YPE]); 1474 ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_T YPE]);
1477 } 1475 }
1478 1476
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 String originalContents = "$prefix$removed$suffix"; 1783 String originalContents = "$prefix$removed$suffix";
1786 String modifiedContents = "$prefix$added$suffix"; 1784 String modifiedContents = "$prefix$added$suffix";
1787 int replaceStart = prefix.length; 1785 int replaceStart = prefix.length;
1788 Source source = new TestSource(); 1786 Source source = new TestSource();
1789 // 1787 //
1790 // Parse the original contents. 1788 // Parse the original contents.
1791 // 1789 //
1792 GatheringErrorListener originalListener = new GatheringErrorListener(); 1790 GatheringErrorListener originalListener = new GatheringErrorListener();
1793 Scanner originalScanner = new Scanner(source, new CharSequenceReader(origina lContents), originalListener); 1791 Scanner originalScanner = new Scanner(source, new CharSequenceReader(origina lContents), originalListener);
1794 Token originalTokens = originalScanner.tokenize(); 1792 Token originalTokens = originalScanner.tokenize();
1795 JUnitTestCase.assertNotNull(originalTokens); 1793 expect(originalTokens, isNotNull);
1796 Parser originalParser = new Parser(source, originalListener); 1794 Parser originalParser = new Parser(source, originalListener);
1797 CompilationUnit originalUnit = originalParser.parseCompilationUnit(originalT okens); 1795 CompilationUnit originalUnit = originalParser.parseCompilationUnit(originalT okens);
1798 JUnitTestCase.assertNotNull(originalUnit); 1796 expect(originalUnit, isNotNull);
1799 // 1797 //
1800 // Parse the modified contents. 1798 // Parse the modified contents.
1801 // 1799 //
1802 GatheringErrorListener modifiedListener = new GatheringErrorListener(); 1800 GatheringErrorListener modifiedListener = new GatheringErrorListener();
1803 Scanner modifiedScanner = new Scanner(source, new CharSequenceReader(modifie dContents), modifiedListener); 1801 Scanner modifiedScanner = new Scanner(source, new CharSequenceReader(modifie dContents), modifiedListener);
1804 Token modifiedTokens = modifiedScanner.tokenize(); 1802 Token modifiedTokens = modifiedScanner.tokenize();
1805 JUnitTestCase.assertNotNull(modifiedTokens); 1803 expect(modifiedTokens, isNotNull);
1806 Parser modifiedParser = new Parser(source, modifiedListener); 1804 Parser modifiedParser = new Parser(source, modifiedListener);
1807 CompilationUnit modifiedUnit = modifiedParser.parseCompilationUnit(modifiedT okens); 1805 CompilationUnit modifiedUnit = modifiedParser.parseCompilationUnit(modifiedT okens);
1808 JUnitTestCase.assertNotNull(modifiedUnit); 1806 expect(modifiedUnit, isNotNull);
1809 // 1807 //
1810 // Incrementally parse the modified contents. 1808 // Incrementally parse the modified contents.
1811 // 1809 //
1812 GatheringErrorListener incrementalListener = new GatheringErrorListener(); 1810 GatheringErrorListener incrementalListener = new GatheringErrorListener();
1813 IncrementalScanner incrementalScanner = new IncrementalScanner(source, new C harSequenceReader(modifiedContents), incrementalListener); 1811 IncrementalScanner incrementalScanner = new IncrementalScanner(source, new C harSequenceReader(modifiedContents), incrementalListener);
1814 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS tart, removed.length, added.length); 1812 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS tart, removed.length, added.length);
1815 JUnitTestCase.assertNotNull(incrementalTokens); 1813 expect(incrementalTokens, isNotNull);
1816 IncrementalParser incrementalParser = new IncrementalParser(source, incremen talScanner.tokenMap, incrementalListener); 1814 IncrementalParser incrementalParser = new IncrementalParser(source, incremen talScanner.tokenMap, incrementalListener);
1817 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix. length + removed.length); 1815 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix. length + removed.length);
1818 JUnitTestCase.assertNotNull(incrementalUnit); 1816 expect(incrementalUnit, isNotNull);
1819 // 1817 //
1820 // Validate that the results of the incremental parse are the same as the fu ll parse of the 1818 // Validate that the results of the incremental parse are the same as the fu ll parse of the
1821 // modified source. 1819 // modified source.
1822 // 1820 //
1823 JUnitTestCase.assertTrue(AstComparator.equalNodes(modifiedUnit, incrementalU nit)); 1821 expect(AstComparator.equalNodes(modifiedUnit, incrementalUnit), isTrue);
1824 // TODO(brianwilkerson) Verify that the errors are correct? 1822 // TODO(brianwilkerson) Verify that the errors are correct?
1825 } 1823 }
1826 } 1824 }
1827 1825
1828 class NonErrorParserTest extends ParserTestCase { 1826 class NonErrorParserTest extends ParserTestCase {
1829 void test_constFactory_external() { 1827 void test_constFactory_external() {
1830 ParserTestCase.parse("parseClassMember", <Object> ["C"], "external const fac tory C();"); 1828 ParserTestCase.parse("parseClassMember", <Object> ["C"], "external const fac tory C();");
1831 } 1829 }
1832 } 1830 }
1833 1831
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 1941 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
1944 * not match those that are expected, or if the result would have be en `null` 1942 * not match those that are expected, or if the result would have be en `null`
1945 */ 1943 */
1946 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err orCodes) { 1944 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err orCodes) {
1947 GatheringErrorListener listener = new GatheringErrorListener(); 1945 GatheringErrorListener listener = new GatheringErrorListener();
1948 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 1946 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
1949 listener.setLineInfo(new TestSource(), scanner.lineStarts); 1947 listener.setLineInfo(new TestSource(), scanner.lineStarts);
1950 Token token = scanner.tokenize(); 1948 Token token = scanner.tokenize();
1951 Parser parser = createParser(listener); 1949 Parser parser = createParser(listener);
1952 CompilationUnit unit = parser.parseCompilationUnit(token); 1950 CompilationUnit unit = parser.parseCompilationUnit(token);
1953 JUnitTestCase.assertNotNull(unit); 1951 expect(unit, isNotNull);
1954 listener.assertErrorsWithCodes(errorCodes); 1952 listener.assertErrorsWithCodes(errorCodes);
1955 return unit; 1953 return unit;
1956 } 1954 }
1957 1955
1958 /** 1956 /**
1959 * Parse the given source as an expression. 1957 * Parse the given source as an expression.
1960 * 1958 *
1961 * @param source the source to be parsed 1959 * @param source the source to be parsed
1962 * @param errorCodes the error codes of the errors that are expected to be fou nd 1960 * @param errorCodes the error codes of the errors that are expected to be fou nd
1963 * @return the expression that was parsed 1961 * @return the expression that was parsed
1964 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 1962 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
1965 * not match those that are expected, or if the result would have be en `null` 1963 * not match those that are expected, or if the result would have be en `null`
1966 */ 1964 */
1967 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { 1965 static Expression parseExpression(String source, List<ErrorCode> errorCodes) {
1968 GatheringErrorListener listener = new GatheringErrorListener(); 1966 GatheringErrorListener listener = new GatheringErrorListener();
1969 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 1967 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
1970 listener.setLineInfo(new TestSource(), scanner.lineStarts); 1968 listener.setLineInfo(new TestSource(), scanner.lineStarts);
1971 Token token = scanner.tokenize(); 1969 Token token = scanner.tokenize();
1972 Parser parser = createParser(listener); 1970 Parser parser = createParser(listener);
1973 Expression expression = parser.parseExpression(token); 1971 Expression expression = parser.parseExpression(token);
1974 JUnitTestCase.assertNotNull(expression); 1972 expect(expression, isNotNull);
1975 listener.assertErrorsWithCodes(errorCodes); 1973 listener.assertErrorsWithCodes(errorCodes);
1976 return expression; 1974 return expression;
1977 } 1975 }
1978 1976
1979 /** 1977 /**
1980 * Parse the given source as a statement. 1978 * Parse the given source as a statement.
1981 * 1979 *
1982 * @param source the source to be parsed 1980 * @param source the source to be parsed
1983 * @param errorCodes the error codes of the errors that are expected to be fou nd 1981 * @param errorCodes the error codes of the errors that are expected to be fou nd
1984 * @return the statement that was parsed 1982 * @return the statement that was parsed
1985 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 1983 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
1986 * not match those that are expected, or if the result would have be en `null` 1984 * not match those that are expected, or if the result would have be en `null`
1987 */ 1985 */
1988 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { 1986 static Statement parseStatement(String source, List<ErrorCode> errorCodes) {
1989 GatheringErrorListener listener = new GatheringErrorListener(); 1987 GatheringErrorListener listener = new GatheringErrorListener();
1990 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 1988 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
1991 listener.setLineInfo(new TestSource(), scanner.lineStarts); 1989 listener.setLineInfo(new TestSource(), scanner.lineStarts);
1992 Token token = scanner.tokenize(); 1990 Token token = scanner.tokenize();
1993 Parser parser = createParser(listener); 1991 Parser parser = createParser(listener);
1994 Statement statement = parser.parseStatement(token); 1992 Statement statement = parser.parseStatement(token);
1995 JUnitTestCase.assertNotNull(statement); 1993 expect(statement, isNotNull);
1996 listener.assertErrorsWithCodes(errorCodes); 1994 listener.assertErrorsWithCodes(errorCodes);
1997 return statement; 1995 return statement;
1998 } 1996 }
1999 1997
2000 /** 1998 /**
2001 * Parse the given source as a sequence of statements. 1999 * Parse the given source as a sequence of statements.
2002 * 2000 *
2003 * @param source the source to be parsed 2001 * @param source the source to be parsed
2004 * @param expectedCount the number of statements that are expected 2002 * @param expectedCount the number of statements that are expected
2005 * @param errorCodes the error codes of the errors that are expected to be fou nd 2003 * @param errorCodes the error codes of the errors that are expected to be fou nd
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 // 2046 //
2049 Parser parser = createParser(listener); 2047 Parser parser = createParser(listener);
2050 parser.parseFunctionBodies = parseFunctionBodies; 2048 parser.parseFunctionBodies = parseFunctionBodies;
2051 parser.parseDeferredLibraries = true; 2049 parser.parseDeferredLibraries = true;
2052 parser.parseAsync = true; 2050 parser.parseAsync = true;
2053 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr eam); 2051 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr eam);
2054 // 2052 //
2055 // Partially test the results. 2053 // Partially test the results.
2056 // 2054 //
2057 if (!listener.hasErrors) { 2055 if (!listener.hasErrors) {
2058 JUnitTestCase.assertNotNull(result); 2056 expect(result, isNotNull);
2059 } 2057 }
2060 return result; 2058 return result;
2061 } 2059 }
2062 2060
2063 /** 2061 /**
2064 * Invoke a method in [Parser]. The method is assumed to have no arguments. 2062 * Invoke a method in [Parser]. The method is assumed to have no arguments.
2065 * 2063 *
2066 * The given source is scanned and the parser is initialized to start with the first token in the 2064 * The given source is scanned and the parser is initialized to start with the first token in the
2067 * source before the method is invoked. 2065 * source before the method is invoked.
2068 * 2066 *
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 map.forEach((name, value) { 2116 map.forEach((name, value) {
2119 result[new Symbol(name)] = value; 2117 result[new Symbol(name)] = value;
2120 }); 2118 });
2121 return result; 2119 return result;
2122 }''', []); 2120 }''', []);
2123 } 2121 }
2124 2122
2125 void test_additiveExpression_missing_LHS() { 2123 void test_additiveExpression_missing_LHS() {
2126 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2124 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2127 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2125 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2128 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2126 expect(expression.leftOperand.isSynthetic, isTrue);
2129 } 2127 }
2130 2128
2131 void test_additiveExpression_missing_LHS_RHS() { 2129 void test_additiveExpression_missing_LHS_RHS() {
2132 BinaryExpression expression = ParserTestCase.parseExpression("+", [ 2130 BinaryExpression expression = ParserTestCase.parseExpression("+", [
2133 ParserErrorCode.MISSING_IDENTIFIER, 2131 ParserErrorCode.MISSING_IDENTIFIER,
2134 ParserErrorCode.MISSING_IDENTIFIER]); 2132 ParserErrorCode.MISSING_IDENTIFIER]);
2135 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2133 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2136 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2134 expect(expression.leftOperand.isSynthetic, isTrue);
2137 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2135 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2138 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2136 expect(expression.rightOperand.isSynthetic, isTrue);
2139 } 2137 }
2140 2138
2141 void test_additiveExpression_missing_RHS() { 2139 void test_additiveExpression_missing_RHS() {
2142 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]); 2140 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]);
2143 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2141 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2144 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2142 expect(expression.rightOperand.isSynthetic, isTrue);
2145 } 2143 }
2146 2144
2147 void test_additiveExpression_missing_RHS_super() { 2145 void test_additiveExpression_missing_RHS_super() {
2148 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]); 2146 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]);
2149 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2147 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2150 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2148 expect(expression.rightOperand.isSynthetic, isTrue);
2151 } 2149 }
2152 2150
2153 void test_additiveExpression_precedence_multiplicative_left() { 2151 void test_additiveExpression_precedence_multiplicative_left() {
2154 BinaryExpression expression = ParserTestCase.parseExpression("* +", [ 2152 BinaryExpression expression = ParserTestCase.parseExpression("* +", [
2155 ParserErrorCode.MISSING_IDENTIFIER, 2153 ParserErrorCode.MISSING_IDENTIFIER,
2156 ParserErrorCode.MISSING_IDENTIFIER, 2154 ParserErrorCode.MISSING_IDENTIFIER,
2157 ParserErrorCode.MISSING_IDENTIFIER]); 2155 ParserErrorCode.MISSING_IDENTIFIER]);
2158 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2156 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2159 } 2157 }
2160 2158
2161 void test_additiveExpression_precedence_multiplicative_right() { 2159 void test_additiveExpression_precedence_multiplicative_right() {
2162 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [ 2160 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [
2163 ParserErrorCode.MISSING_IDENTIFIER, 2161 ParserErrorCode.MISSING_IDENTIFIER,
2164 ParserErrorCode.MISSING_IDENTIFIER, 2162 ParserErrorCode.MISSING_IDENTIFIER,
2165 ParserErrorCode.MISSING_IDENTIFIER]); 2163 ParserErrorCode.MISSING_IDENTIFIER]);
2166 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 2164 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
2167 } 2165 }
2168 2166
2169 void test_additiveExpression_super() { 2167 void test_additiveExpression_super() {
2170 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [ 2168 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [
2171 ParserErrorCode.MISSING_IDENTIFIER, 2169 ParserErrorCode.MISSING_IDENTIFIER,
2172 ParserErrorCode.MISSING_IDENTIFIER]); 2170 ParserErrorCode.MISSING_IDENTIFIER]);
2173 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2171 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2174 } 2172 }
2175 2173
2176 void test_assignmentExpression_missing_compound1() { 2174 void test_assignmentExpression_missing_compound1() {
2177 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 2175 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
2178 Expression syntheticExpression = expression.leftHandSide; 2176 Expression syntheticExpression = expression.leftHandSide;
2179 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2177 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2180 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2178 expect(syntheticExpression.isSynthetic, isTrue);
2181 } 2179 }
2182 2180
2183 void test_assignmentExpression_missing_compound2() { 2181 void test_assignmentExpression_missing_compound2() {
2184 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 2182 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
2185 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).leftHandSide; 2183 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).leftHandSide;
2186 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2184 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2187 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2185 expect(syntheticExpression.isSynthetic, isTrue);
2188 } 2186 }
2189 2187
2190 void test_assignmentExpression_missing_compound3() { 2188 void test_assignmentExpression_missing_compound3() {
2191 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]); 2189 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
2192 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).rightHandSide; 2190 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).rightHandSide;
2193 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2191 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2194 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2192 expect(syntheticExpression.isSynthetic, isTrue);
2195 } 2193 }
2196 2194
2197 void test_assignmentExpression_missing_LHS() { 2195 void test_assignmentExpression_missing_LHS() {
2198 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [Par serErrorCode.MISSING_IDENTIFIER]); 2196 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [Par serErrorCode.MISSING_IDENTIFIER]);
2199 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide); 2197 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide);
2200 JUnitTestCase.assertTrue(expression.leftHandSide.isSynthetic); 2198 expect(expression.leftHandSide.isSynthetic, isTrue);
2201 } 2199 }
2202 2200
2203 void test_assignmentExpression_missing_RHS() { 2201 void test_assignmentExpression_missing_RHS() {
2204 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]); 2202 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]);
2205 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide); 2203 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftHandSide);
2206 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic); 2204 expect(expression.rightHandSide.isSynthetic, isTrue);
2207 } 2205 }
2208 2206
2209 void test_bitwiseAndExpression_missing_LHS() { 2207 void test_bitwiseAndExpression_missing_LHS() {
2210 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2208 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2211 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2209 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2212 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2210 expect(expression.leftOperand.isSynthetic, isTrue);
2213 } 2211 }
2214 2212
2215 void test_bitwiseAndExpression_missing_LHS_RHS() { 2213 void test_bitwiseAndExpression_missing_LHS_RHS() {
2216 BinaryExpression expression = ParserTestCase.parseExpression("&", [ 2214 BinaryExpression expression = ParserTestCase.parseExpression("&", [
2217 ParserErrorCode.MISSING_IDENTIFIER, 2215 ParserErrorCode.MISSING_IDENTIFIER,
2218 ParserErrorCode.MISSING_IDENTIFIER]); 2216 ParserErrorCode.MISSING_IDENTIFIER]);
2219 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2217 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2220 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2218 expect(expression.leftOperand.isSynthetic, isTrue);
2221 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2219 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2222 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2220 expect(expression.rightOperand.isSynthetic, isTrue);
2223 } 2221 }
2224 2222
2225 void test_bitwiseAndExpression_missing_RHS() { 2223 void test_bitwiseAndExpression_missing_RHS() {
2226 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]); 2224 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]);
2227 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2225 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2228 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2226 expect(expression.rightOperand.isSynthetic, isTrue);
2229 } 2227 }
2230 2228
2231 void test_bitwiseAndExpression_missing_RHS_super() { 2229 void test_bitwiseAndExpression_missing_RHS_super() {
2232 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]); 2230 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]);
2233 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2231 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2234 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2232 expect(expression.rightOperand.isSynthetic, isTrue);
2235 } 2233 }
2236 2234
2237 void test_bitwiseAndExpression_precedence_equality_left() { 2235 void test_bitwiseAndExpression_precedence_equality_left() {
2238 BinaryExpression expression = ParserTestCase.parseExpression("== &&", [ 2236 BinaryExpression expression = ParserTestCase.parseExpression("== &&", [
2239 ParserErrorCode.MISSING_IDENTIFIER, 2237 ParserErrorCode.MISSING_IDENTIFIER,
2240 ParserErrorCode.MISSING_IDENTIFIER, 2238 ParserErrorCode.MISSING_IDENTIFIER,
2241 ParserErrorCode.MISSING_IDENTIFIER]); 2239 ParserErrorCode.MISSING_IDENTIFIER]);
2242 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2240 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2243 } 2241 }
2244 2242
2245 void test_bitwiseAndExpression_precedence_equality_right() { 2243 void test_bitwiseAndExpression_precedence_equality_right() {
2246 BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [ 2244 BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [
2247 ParserErrorCode.MISSING_IDENTIFIER, 2245 ParserErrorCode.MISSING_IDENTIFIER,
2248 ParserErrorCode.MISSING_IDENTIFIER, 2246 ParserErrorCode.MISSING_IDENTIFIER,
2249 ParserErrorCode.MISSING_IDENTIFIER]); 2247 ParserErrorCode.MISSING_IDENTIFIER]);
2250 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 2248 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
2251 } 2249 }
2252 2250
2253 void test_bitwiseAndExpression_super() { 2251 void test_bitwiseAndExpression_super() {
2254 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [ 2252 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [
2255 ParserErrorCode.MISSING_IDENTIFIER, 2253 ParserErrorCode.MISSING_IDENTIFIER,
2256 ParserErrorCode.MISSING_IDENTIFIER]); 2254 ParserErrorCode.MISSING_IDENTIFIER]);
2257 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2255 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2258 } 2256 }
2259 2257
2260 void test_bitwiseOrExpression_missing_LHS() { 2258 void test_bitwiseOrExpression_missing_LHS() {
2261 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2259 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2262 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2260 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2263 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2261 expect(expression.leftOperand.isSynthetic, isTrue);
2264 } 2262 }
2265 2263
2266 void test_bitwiseOrExpression_missing_LHS_RHS() { 2264 void test_bitwiseOrExpression_missing_LHS_RHS() {
2267 BinaryExpression expression = ParserTestCase.parseExpression("|", [ 2265 BinaryExpression expression = ParserTestCase.parseExpression("|", [
2268 ParserErrorCode.MISSING_IDENTIFIER, 2266 ParserErrorCode.MISSING_IDENTIFIER,
2269 ParserErrorCode.MISSING_IDENTIFIER]); 2267 ParserErrorCode.MISSING_IDENTIFIER]);
2270 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2268 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2271 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2269 expect(expression.leftOperand.isSynthetic, isTrue);
2272 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2270 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2273 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2271 expect(expression.rightOperand.isSynthetic, isTrue);
2274 } 2272 }
2275 2273
2276 void test_bitwiseOrExpression_missing_RHS() { 2274 void test_bitwiseOrExpression_missing_RHS() {
2277 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]); 2275 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]);
2278 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2276 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2279 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2277 expect(expression.rightOperand.isSynthetic, isTrue);
2280 } 2278 }
2281 2279
2282 void test_bitwiseOrExpression_missing_RHS_super() { 2280 void test_bitwiseOrExpression_missing_RHS_super() {
2283 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]); 2281 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]);
2284 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2282 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2285 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2283 expect(expression.rightOperand.isSynthetic, isTrue);
2286 } 2284 }
2287 2285
2288 void test_bitwiseOrExpression_precedence_xor_left() { 2286 void test_bitwiseOrExpression_precedence_xor_left() {
2289 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [ 2287 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [
2290 ParserErrorCode.MISSING_IDENTIFIER, 2288 ParserErrorCode.MISSING_IDENTIFIER,
2291 ParserErrorCode.MISSING_IDENTIFIER, 2289 ParserErrorCode.MISSING_IDENTIFIER,
2292 ParserErrorCode.MISSING_IDENTIFIER]); 2290 ParserErrorCode.MISSING_IDENTIFIER]);
2293 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2291 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2294 } 2292 }
2295 2293
2296 void test_bitwiseOrExpression_precedence_xor_right() { 2294 void test_bitwiseOrExpression_precedence_xor_right() {
2297 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [ 2295 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [
2298 ParserErrorCode.MISSING_IDENTIFIER, 2296 ParserErrorCode.MISSING_IDENTIFIER,
2299 ParserErrorCode.MISSING_IDENTIFIER, 2297 ParserErrorCode.MISSING_IDENTIFIER,
2300 ParserErrorCode.MISSING_IDENTIFIER]); 2298 ParserErrorCode.MISSING_IDENTIFIER]);
2301 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 2299 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
2302 } 2300 }
2303 2301
2304 void test_bitwiseOrExpression_super() { 2302 void test_bitwiseOrExpression_super() {
2305 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [ 2303 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [
2306 ParserErrorCode.MISSING_IDENTIFIER, 2304 ParserErrorCode.MISSING_IDENTIFIER,
2307 ParserErrorCode.MISSING_IDENTIFIER]); 2305 ParserErrorCode.MISSING_IDENTIFIER]);
2308 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2306 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2309 } 2307 }
2310 2308
2311 void test_bitwiseXorExpression_missing_LHS() { 2309 void test_bitwiseXorExpression_missing_LHS() {
2312 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2310 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2313 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2311 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2314 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2312 expect(expression.leftOperand.isSynthetic, isTrue);
2315 } 2313 }
2316 2314
2317 void test_bitwiseXorExpression_missing_LHS_RHS() { 2315 void test_bitwiseXorExpression_missing_LHS_RHS() {
2318 BinaryExpression expression = ParserTestCase.parseExpression("^", [ 2316 BinaryExpression expression = ParserTestCase.parseExpression("^", [
2319 ParserErrorCode.MISSING_IDENTIFIER, 2317 ParserErrorCode.MISSING_IDENTIFIER,
2320 ParserErrorCode.MISSING_IDENTIFIER]); 2318 ParserErrorCode.MISSING_IDENTIFIER]);
2321 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2319 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2322 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2320 expect(expression.leftOperand.isSynthetic, isTrue);
2323 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2321 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2324 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2322 expect(expression.rightOperand.isSynthetic, isTrue);
2325 } 2323 }
2326 2324
2327 void test_bitwiseXorExpression_missing_RHS() { 2325 void test_bitwiseXorExpression_missing_RHS() {
2328 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]); 2326 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]);
2329 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2327 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2330 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2328 expect(expression.rightOperand.isSynthetic, isTrue);
2331 } 2329 }
2332 2330
2333 void test_bitwiseXorExpression_missing_RHS_super() { 2331 void test_bitwiseXorExpression_missing_RHS_super() {
2334 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]); 2332 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]);
2335 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2333 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2336 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2334 expect(expression.rightOperand.isSynthetic, isTrue);
2337 } 2335 }
2338 2336
2339 void test_bitwiseXorExpression_precedence_and_left() { 2337 void test_bitwiseXorExpression_precedence_and_left() {
2340 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [ 2338 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [
2341 ParserErrorCode.MISSING_IDENTIFIER, 2339 ParserErrorCode.MISSING_IDENTIFIER,
2342 ParserErrorCode.MISSING_IDENTIFIER, 2340 ParserErrorCode.MISSING_IDENTIFIER,
2343 ParserErrorCode.MISSING_IDENTIFIER]); 2341 ParserErrorCode.MISSING_IDENTIFIER]);
2344 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2342 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2345 } 2343 }
2346 2344
(...skipping 14 matching lines...) Expand all
2361 2359
2362 void test_classTypeAlias_withBody() { 2360 void test_classTypeAlias_withBody() {
2363 ParserTestCase.parseCompilationUnit(r''' 2361 ParserTestCase.parseCompilationUnit(r'''
2364 class A {} 2362 class A {}
2365 class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]); 2363 class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
2366 } 2364 }
2367 2365
2368 void test_conditionalExpression_missingElse() { 2366 void test_conditionalExpression_missingElse() {
2369 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]); 2367 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
2370 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.elseExpression); 2368 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.elseExpression);
2371 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic); 2369 expect(expression.elseExpression.isSynthetic, isTrue);
2372 } 2370 }
2373 2371
2374 void test_conditionalExpression_missingThen() { 2372 void test_conditionalExpression_missingThen() {
2375 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]); 2373 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]);
2376 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.thenExpression); 2374 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.thenExpression);
2377 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic); 2375 expect(expression.thenExpression.isSynthetic, isTrue);
2378 } 2376 }
2379 2377
2380 void test_equalityExpression_missing_LHS() { 2378 void test_equalityExpression_missing_LHS() {
2381 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]); 2379 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]);
2382 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2380 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2383 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2381 expect(expression.leftOperand.isSynthetic, isTrue);
2384 } 2382 }
2385 2383
2386 void test_equalityExpression_missing_LHS_RHS() { 2384 void test_equalityExpression_missing_LHS_RHS() {
2387 BinaryExpression expression = ParserTestCase.parseExpression("==", [ 2385 BinaryExpression expression = ParserTestCase.parseExpression("==", [
2388 ParserErrorCode.MISSING_IDENTIFIER, 2386 ParserErrorCode.MISSING_IDENTIFIER,
2389 ParserErrorCode.MISSING_IDENTIFIER]); 2387 ParserErrorCode.MISSING_IDENTIFIER]);
2390 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2388 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2391 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2389 expect(expression.leftOperand.isSynthetic, isTrue);
2392 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2390 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2393 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2391 expect(expression.rightOperand.isSynthetic, isTrue);
2394 } 2392 }
2395 2393
2396 void test_equalityExpression_missing_RHS() { 2394 void test_equalityExpression_missing_RHS() {
2397 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]); 2395 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]);
2398 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2396 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2399 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2397 expect(expression.rightOperand.isSynthetic, isTrue);
2400 } 2398 }
2401 2399
2402 void test_equalityExpression_missing_RHS_super() { 2400 void test_equalityExpression_missing_RHS_super() {
2403 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]); 2401 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]);
2404 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2402 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2405 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2403 expect(expression.rightOperand.isSynthetic, isTrue);
2406 } 2404 }
2407 2405
2408 void test_equalityExpression_precedence_relational_left() { 2406 void test_equalityExpression_precedence_relational_left() {
2409 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [ 2407 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [
2410 ParserErrorCode.EXPECTED_TYPE_NAME, 2408 ParserErrorCode.EXPECTED_TYPE_NAME,
2411 ParserErrorCode.MISSING_IDENTIFIER, 2409 ParserErrorCode.MISSING_IDENTIFIER,
2412 ParserErrorCode.MISSING_IDENTIFIER]); 2410 ParserErrorCode.MISSING_IDENTIFIER]);
2413 EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand); 2411 EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand);
2414 } 2412 }
2415 2413
(...skipping 11 matching lines...) Expand all
2427 ParserErrorCode.MISSING_IDENTIFIER, 2425 ParserErrorCode.MISSING_IDENTIFIER,
2428 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 2426 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
2429 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2427 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2430 } 2428 }
2431 2429
2432 void test_expressionList_multiple_end() { 2430 void test_expressionList_multiple_end() {
2433 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]);
2434 EngineTestCase.assertSizeOfList(4, result); 2432 EngineTestCase.assertSizeOfList(4, result);
2435 Expression syntheticExpression = result[0]; 2433 Expression syntheticExpression = result[0];
2436 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2434 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2437 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2435 expect(syntheticExpression.isSynthetic, isTrue);
2438 } 2436 }
2439 2437
2440 void test_expressionList_multiple_middle() { 2438 void test_expressionList_multiple_middle() {
2441 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]);
2442 EngineTestCase.assertSizeOfList(4, result); 2440 EngineTestCase.assertSizeOfList(4, result);
2443 Expression syntheticExpression = result[2]; 2441 Expression syntheticExpression = result[2];
2444 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2442 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2445 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2443 expect(syntheticExpression.isSynthetic, isTrue);
2446 } 2444 }
2447 2445
2448 void test_expressionList_multiple_start() { 2446 void test_expressionList_multiple_start() {
2449 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]);
2450 EngineTestCase.assertSizeOfList(4, result); 2448 EngineTestCase.assertSizeOfList(4, result);
2451 Expression syntheticExpression = result[3]; 2449 Expression syntheticExpression = result[3];
2452 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression); 2450 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, syntheticExpression);
2453 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 2451 expect(syntheticExpression.isSynthetic, isTrue);
2454 } 2452 }
2455 2453
2456 void test_functionExpression_in_ConstructorFieldInitializer() { 2454 void test_functionExpression_in_ConstructorFieldInitializer() {
2457 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class A { A() : a = (){}; var v; }", [ 2455 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class A { A() : a = (){}; var v; }", [
2458 ParserErrorCode.MISSING_IDENTIFIER, 2456 ParserErrorCode.MISSING_IDENTIFIER,
2459 ParserErrorCode.UNEXPECTED_TOKEN]); 2457 ParserErrorCode.UNEXPECTED_TOKEN]);
2460 // Make sure we recovered and parsed "var v" correctly 2458 // Make sure we recovered and parsed "var v" correctly
2461 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 2459 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
2462 NodeList<ClassMember> members = declaration.members; 2460 NodeList<ClassMember> members = declaration.members;
2463 ClassMember fieldDecl = members[1]; 2461 ClassMember fieldDecl = members[1];
2464 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, fieldDecl); 2462 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, fieldDecl);
2465 NodeList<VariableDeclaration> vars = (fieldDecl as FieldDeclaration).fields. variables; 2463 NodeList<VariableDeclaration> vars = (fieldDecl as FieldDeclaration).fields. variables;
2466 EngineTestCase.assertSizeOfList(1, vars); 2464 EngineTestCase.assertSizeOfList(1, vars);
2467 JUnitTestCase.assertEquals("v", vars[0].name.name); 2465 expect(vars[0].name.name, "v");
2468 } 2466 }
2469 2467
2470 void test_incomplete_topLevelVariable() { 2468 void test_incomplete_topLevelVariable() {
2471 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]); 2469 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]);
2472 NodeList<CompilationUnitMember> declarations = unit.declarations; 2470 NodeList<CompilationUnitMember> declarations = unit.declarations;
2473 EngineTestCase.assertSizeOfList(1, declarations); 2471 EngineTestCase.assertSizeOfList(1, declarations);
2474 CompilationUnitMember member = declarations[0]; 2472 CompilationUnitMember member = declarations[0];
2475 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2473 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2476 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2474 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2477 EngineTestCase.assertSizeOfList(1, variables); 2475 EngineTestCase.assertSizeOfList(1, variables);
2478 SimpleIdentifier name = variables[0].name; 2476 SimpleIdentifier name = variables[0].name;
2479 JUnitTestCase.assertTrue(name.isSynthetic); 2477 expect(name.isSynthetic, isTrue);
2480 } 2478 }
2481 2479
2482 void test_incomplete_topLevelVariable_const() { 2480 void test_incomplete_topLevelVariable_const() {
2483 CompilationUnit unit = ParserTestCase.parseCompilationUnit("const ", [ 2481 CompilationUnit unit = ParserTestCase.parseCompilationUnit("const ", [
2484 ParserErrorCode.MISSING_IDENTIFIER, 2482 ParserErrorCode.MISSING_IDENTIFIER,
2485 ParserErrorCode.EXPECTED_TOKEN]); 2483 ParserErrorCode.EXPECTED_TOKEN]);
2486 NodeList<CompilationUnitMember> declarations = unit.declarations; 2484 NodeList<CompilationUnitMember> declarations = unit.declarations;
2487 EngineTestCase.assertSizeOfList(1, declarations); 2485 EngineTestCase.assertSizeOfList(1, declarations);
2488 CompilationUnitMember member = declarations[0]; 2486 CompilationUnitMember member = declarations[0];
2489 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2487 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2490 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2488 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2491 EngineTestCase.assertSizeOfList(1, variables); 2489 EngineTestCase.assertSizeOfList(1, variables);
2492 SimpleIdentifier name = variables[0].name; 2490 SimpleIdentifier name = variables[0].name;
2493 JUnitTestCase.assertTrue(name.isSynthetic); 2491 expect(name.isSynthetic, isTrue);
2494 } 2492 }
2495 2493
2496 void test_incomplete_topLevelVariable_final() { 2494 void test_incomplete_topLevelVariable_final() {
2497 CompilationUnit unit = ParserTestCase.parseCompilationUnit("final ", [ 2495 CompilationUnit unit = ParserTestCase.parseCompilationUnit("final ", [
2498 ParserErrorCode.MISSING_IDENTIFIER, 2496 ParserErrorCode.MISSING_IDENTIFIER,
2499 ParserErrorCode.EXPECTED_TOKEN]); 2497 ParserErrorCode.EXPECTED_TOKEN]);
2500 NodeList<CompilationUnitMember> declarations = unit.declarations; 2498 NodeList<CompilationUnitMember> declarations = unit.declarations;
2501 EngineTestCase.assertSizeOfList(1, declarations); 2499 EngineTestCase.assertSizeOfList(1, declarations);
2502 CompilationUnitMember member = declarations[0]; 2500 CompilationUnitMember member = declarations[0];
2503 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2501 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2504 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2502 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2505 EngineTestCase.assertSizeOfList(1, variables); 2503 EngineTestCase.assertSizeOfList(1, variables);
2506 SimpleIdentifier name = variables[0].name; 2504 SimpleIdentifier name = variables[0].name;
2507 JUnitTestCase.assertTrue(name.isSynthetic); 2505 expect(name.isSynthetic, isTrue);
2508 } 2506 }
2509 2507
2510 void test_incomplete_topLevelVariable_var() { 2508 void test_incomplete_topLevelVariable_var() {
2511 CompilationUnit unit = ParserTestCase.parseCompilationUnit("var ", [ 2509 CompilationUnit unit = ParserTestCase.parseCompilationUnit("var ", [
2512 ParserErrorCode.MISSING_IDENTIFIER, 2510 ParserErrorCode.MISSING_IDENTIFIER,
2513 ParserErrorCode.EXPECTED_TOKEN]); 2511 ParserErrorCode.EXPECTED_TOKEN]);
2514 NodeList<CompilationUnitMember> declarations = unit.declarations; 2512 NodeList<CompilationUnitMember> declarations = unit.declarations;
2515 EngineTestCase.assertSizeOfList(1, declarations); 2513 EngineTestCase.assertSizeOfList(1, declarations);
2516 CompilationUnitMember member = declarations[0]; 2514 CompilationUnitMember member = declarations[0];
2517 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member); 2515 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
2518 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables; 2516 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
2519 EngineTestCase.assertSizeOfList(1, variables); 2517 EngineTestCase.assertSizeOfList(1, variables);
2520 SimpleIdentifier name = variables[0].name; 2518 SimpleIdentifier name = variables[0].name;
2521 JUnitTestCase.assertTrue(name.isSynthetic); 2519 expect(name.isSynthetic, isTrue);
2522 } 2520 }
2523 2521
2524 void test_incompleteField_const() { 2522 void test_incompleteField_const() {
2525 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2523 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2526 class C { 2524 class C {
2527 const 2525 const
2528 }''', [ 2526 }''', [
2529 ParserErrorCode.MISSING_IDENTIFIER, 2527 ParserErrorCode.MISSING_IDENTIFIER,
2530 ParserErrorCode.EXPECTED_TOKEN]); 2528 ParserErrorCode.EXPECTED_TOKEN]);
2531 NodeList<CompilationUnitMember> declarations = unit.declarations; 2529 NodeList<CompilationUnitMember> declarations = unit.declarations;
2532 EngineTestCase.assertSizeOfList(1, declarations); 2530 EngineTestCase.assertSizeOfList(1, declarations);
2533 CompilationUnitMember unitMember = declarations[0]; 2531 CompilationUnitMember unitMember = declarations[0];
2534 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2532 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2535 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2533 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2536 EngineTestCase.assertSizeOfList(1, members); 2534 EngineTestCase.assertSizeOfList(1, members);
2537 ClassMember classMember = members[0]; 2535 ClassMember classMember = members[0];
2538 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2536 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2539 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2537 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2540 JUnitTestCase.assertEquals(Keyword.CONST, (fieldList.keyword as KeywordToken ).keyword); 2538 expect((fieldList.keyword as KeywordToken).keyword, Keyword.CONST);
2541 NodeList<VariableDeclaration> fields = fieldList.variables; 2539 NodeList<VariableDeclaration> fields = fieldList.variables;
2542 EngineTestCase.assertSizeOfList(1, fields); 2540 EngineTestCase.assertSizeOfList(1, fields);
2543 VariableDeclaration field = fields[0]; 2541 VariableDeclaration field = fields[0];
2544 JUnitTestCase.assertTrue(field.name.isSynthetic); 2542 expect(field.name.isSynthetic, isTrue);
2545 } 2543 }
2546 2544
2547 void test_incompleteField_final() { 2545 void test_incompleteField_final() {
2548 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2546 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2549 class C { 2547 class C {
2550 final 2548 final
2551 }''', [ 2549 }''', [
2552 ParserErrorCode.MISSING_IDENTIFIER, 2550 ParserErrorCode.MISSING_IDENTIFIER,
2553 ParserErrorCode.EXPECTED_TOKEN]); 2551 ParserErrorCode.EXPECTED_TOKEN]);
2554 NodeList<CompilationUnitMember> declarations = unit.declarations; 2552 NodeList<CompilationUnitMember> declarations = unit.declarations;
2555 EngineTestCase.assertSizeOfList(1, declarations); 2553 EngineTestCase.assertSizeOfList(1, declarations);
2556 CompilationUnitMember unitMember = declarations[0]; 2554 CompilationUnitMember unitMember = declarations[0];
2557 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2555 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2558 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2556 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2559 EngineTestCase.assertSizeOfList(1, members); 2557 EngineTestCase.assertSizeOfList(1, members);
2560 ClassMember classMember = members[0]; 2558 ClassMember classMember = members[0];
2561 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2559 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2562 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2560 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2563 JUnitTestCase.assertEquals(Keyword.FINAL, (fieldList.keyword as KeywordToken ).keyword); 2561 expect((fieldList.keyword as KeywordToken).keyword, Keyword.FINAL);
2564 NodeList<VariableDeclaration> fields = fieldList.variables; 2562 NodeList<VariableDeclaration> fields = fieldList.variables;
2565 EngineTestCase.assertSizeOfList(1, fields); 2563 EngineTestCase.assertSizeOfList(1, fields);
2566 VariableDeclaration field = fields[0]; 2564 VariableDeclaration field = fields[0];
2567 JUnitTestCase.assertTrue(field.name.isSynthetic); 2565 expect(field.name.isSynthetic, isTrue);
2568 } 2566 }
2569 2567
2570 void test_incompleteField_var() { 2568 void test_incompleteField_var() {
2571 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2569 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2572 class C { 2570 class C {
2573 var 2571 var
2574 }''', [ 2572 }''', [
2575 ParserErrorCode.MISSING_IDENTIFIER, 2573 ParserErrorCode.MISSING_IDENTIFIER,
2576 ParserErrorCode.EXPECTED_TOKEN]); 2574 ParserErrorCode.EXPECTED_TOKEN]);
2577 NodeList<CompilationUnitMember> declarations = unit.declarations; 2575 NodeList<CompilationUnitMember> declarations = unit.declarations;
2578 EngineTestCase.assertSizeOfList(1, declarations); 2576 EngineTestCase.assertSizeOfList(1, declarations);
2579 CompilationUnitMember unitMember = declarations[0]; 2577 CompilationUnitMember unitMember = declarations[0];
2580 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember); 2578 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla ration, unitMember);
2581 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members; 2579 NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
2582 EngineTestCase.assertSizeOfList(1, members); 2580 EngineTestCase.assertSizeOfList(1, members);
2583 ClassMember classMember = members[0]; 2581 ClassMember classMember = members[0];
2584 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember); 2582 EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDecla ration, classMember);
2585 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ; 2583 VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields ;
2586 JUnitTestCase.assertEquals(Keyword.VAR, (fieldList.keyword as KeywordToken). keyword); 2584 expect((fieldList.keyword as KeywordToken).keyword, Keyword.VAR);
2587 NodeList<VariableDeclaration> fields = fieldList.variables; 2585 NodeList<VariableDeclaration> fields = fieldList.variables;
2588 EngineTestCase.assertSizeOfList(1, fields); 2586 EngineTestCase.assertSizeOfList(1, fields);
2589 VariableDeclaration field = fields[0]; 2587 VariableDeclaration field = fields[0];
2590 JUnitTestCase.assertTrue(field.name.isSynthetic); 2588 expect(field.name.isSynthetic, isTrue);
2591 } 2589 }
2592 2590
2593 void test_isExpression_noType() { 2591 void test_isExpression_noType() {
2594 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 !)}}", [
2595 ParserErrorCode.EXPECTED_TYPE_NAME, 2593 ParserErrorCode.EXPECTED_TYPE_NAME,
2596 ParserErrorCode.EXPECTED_TYPE_NAME, 2594 ParserErrorCode.EXPECTED_TYPE_NAME,
2597 ParserErrorCode.MISSING_STATEMENT]); 2595 ParserErrorCode.MISSING_STATEMENT]);
2598 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 2596 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
2599 MethodDeclaration method = declaration.members[0] as MethodDeclaration; 2597 MethodDeclaration method = declaration.members[0] as MethodDeclaration;
2600 BlockFunctionBody body = method.body as BlockFunctionBody; 2598 BlockFunctionBody body = method.body as BlockFunctionBody;
2601 IfStatement ifStatement = body.block.statements[1] as IfStatement; 2599 IfStatement ifStatement = body.block.statements[1] as IfStatement;
2602 IsExpression expression = ifStatement.condition as IsExpression; 2600 IsExpression expression = ifStatement.condition as IsExpression;
2603 JUnitTestCase.assertNotNull(expression.expression); 2601 expect(expression.expression, isNotNull);
2604 JUnitTestCase.assertNotNull(expression.isOperator); 2602 expect(expression.isOperator, isNotNull);
2605 JUnitTestCase.assertNotNull(expression.notOperator); 2603 expect(expression.notOperator, isNotNull);
2606 TypeName type = expression.type; 2604 TypeName type = expression.type;
2607 JUnitTestCase.assertNotNull(type); 2605 expect(type, isNotNull);
2608 JUnitTestCase.assertTrue(type.name.isSynthetic); 2606 expect(type.name.isSynthetic, isTrue);
2609 EngineTestCase.assertInstanceOf((obj) => obj is EmptyStatement, EmptyStateme nt, ifStatement.thenStatement); 2607 EngineTestCase.assertInstanceOf((obj) => obj is EmptyStatement, EmptyStateme nt, ifStatement.thenStatement);
2610 } 2608 }
2611 2609
2612 void test_logicalAndExpression_missing_LHS() { 2610 void test_logicalAndExpression_missing_LHS() {
2613 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]); 2611 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]);
2614 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2612 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2615 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2613 expect(expression.leftOperand.isSynthetic, isTrue);
2616 } 2614 }
2617 2615
2618 void test_logicalAndExpression_missing_LHS_RHS() { 2616 void test_logicalAndExpression_missing_LHS_RHS() {
2619 BinaryExpression expression = ParserTestCase.parseExpression("&&", [ 2617 BinaryExpression expression = ParserTestCase.parseExpression("&&", [
2620 ParserErrorCode.MISSING_IDENTIFIER, 2618 ParserErrorCode.MISSING_IDENTIFIER,
2621 ParserErrorCode.MISSING_IDENTIFIER]); 2619 ParserErrorCode.MISSING_IDENTIFIER]);
2622 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2620 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2623 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2621 expect(expression.leftOperand.isSynthetic, isTrue);
2624 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2622 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2625 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2623 expect(expression.rightOperand.isSynthetic, isTrue);
2626 } 2624 }
2627 2625
2628 void test_logicalAndExpression_missing_RHS() { 2626 void test_logicalAndExpression_missing_RHS() {
2629 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]); 2627 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]);
2630 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2628 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2631 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2629 expect(expression.rightOperand.isSynthetic, isTrue);
2632 } 2630 }
2633 2631
2634 void test_logicalAndExpression_precedence_bitwiseOr_left() { 2632 void test_logicalAndExpression_precedence_bitwiseOr_left() {
2635 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [ 2633 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [
2636 ParserErrorCode.MISSING_IDENTIFIER, 2634 ParserErrorCode.MISSING_IDENTIFIER,
2637 ParserErrorCode.MISSING_IDENTIFIER, 2635 ParserErrorCode.MISSING_IDENTIFIER,
2638 ParserErrorCode.MISSING_IDENTIFIER]); 2636 ParserErrorCode.MISSING_IDENTIFIER]);
2639 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2637 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2640 } 2638 }
2641 2639
2642 void test_logicalAndExpression_precedence_bitwiseOr_right() { 2640 void test_logicalAndExpression_precedence_bitwiseOr_right() {
2643 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [ 2641 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [
2644 ParserErrorCode.MISSING_IDENTIFIER, 2642 ParserErrorCode.MISSING_IDENTIFIER,
2645 ParserErrorCode.MISSING_IDENTIFIER, 2643 ParserErrorCode.MISSING_IDENTIFIER,
2646 ParserErrorCode.MISSING_IDENTIFIER]); 2644 ParserErrorCode.MISSING_IDENTIFIER]);
2647 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 2645 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
2648 } 2646 }
2649 2647
2650 void test_logicalOrExpression_missing_LHS() { 2648 void test_logicalOrExpression_missing_LHS() {
2651 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]); 2649 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]);
2652 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2650 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2653 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2651 expect(expression.leftOperand.isSynthetic, isTrue);
2654 } 2652 }
2655 2653
2656 void test_logicalOrExpression_missing_LHS_RHS() { 2654 void test_logicalOrExpression_missing_LHS_RHS() {
2657 BinaryExpression expression = ParserTestCase.parseExpression("||", [ 2655 BinaryExpression expression = ParserTestCase.parseExpression("||", [
2658 ParserErrorCode.MISSING_IDENTIFIER, 2656 ParserErrorCode.MISSING_IDENTIFIER,
2659 ParserErrorCode.MISSING_IDENTIFIER]); 2657 ParserErrorCode.MISSING_IDENTIFIER]);
2660 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2658 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2661 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2659 expect(expression.leftOperand.isSynthetic, isTrue);
2662 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2660 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2663 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2661 expect(expression.rightOperand.isSynthetic, isTrue);
2664 } 2662 }
2665 2663
2666 void test_logicalOrExpression_missing_RHS() { 2664 void test_logicalOrExpression_missing_RHS() {
2667 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]); 2665 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]);
2668 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2666 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2669 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2667 expect(expression.rightOperand.isSynthetic, isTrue);
2670 } 2668 }
2671 2669
2672 void test_logicalOrExpression_precedence_logicalAnd_left() { 2670 void test_logicalOrExpression_precedence_logicalAnd_left() {
2673 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [ 2671 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [
2674 ParserErrorCode.MISSING_IDENTIFIER, 2672 ParserErrorCode.MISSING_IDENTIFIER,
2675 ParserErrorCode.MISSING_IDENTIFIER, 2673 ParserErrorCode.MISSING_IDENTIFIER,
2676 ParserErrorCode.MISSING_IDENTIFIER]); 2674 ParserErrorCode.MISSING_IDENTIFIER]);
2677 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2675 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2678 } 2676 }
2679 2677
2680 void test_logicalOrExpression_precedence_logicalAnd_right() { 2678 void test_logicalOrExpression_precedence_logicalAnd_right() {
2681 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [ 2679 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [
2682 ParserErrorCode.MISSING_IDENTIFIER, 2680 ParserErrorCode.MISSING_IDENTIFIER,
2683 ParserErrorCode.MISSING_IDENTIFIER, 2681 ParserErrorCode.MISSING_IDENTIFIER,
2684 ParserErrorCode.MISSING_IDENTIFIER]); 2682 ParserErrorCode.MISSING_IDENTIFIER]);
2685 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand); 2683 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.rightOperand);
2686 } 2684 }
2687 2685
2688 void test_missingGet() { 2686 void test_missingGet() {
2689 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' 2687 CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
2690 class C { 2688 class C {
2691 int length {} 2689 int length {}
2692 void foo() {} 2690 void foo() {}
2693 }''', [ParserErrorCode.MISSING_GET]); 2691 }''', [ParserErrorCode.MISSING_GET]);
2694 JUnitTestCase.assertNotNull(unit); 2692 expect(unit, isNotNull);
2695 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration ; 2693 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration ;
2696 NodeList<ClassMember> members = classDeclaration.members; 2694 NodeList<ClassMember> members = classDeclaration.members;
2697 EngineTestCase.assertSizeOfList(2, members); 2695 EngineTestCase.assertSizeOfList(2, members);
2698 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, members[0]); 2696 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, members[0]);
2699 ClassMember member = members[1]; 2697 ClassMember member = members[1];
2700 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, member); 2698 EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDec laration, member);
2701 JUnitTestCase.assertEquals("foo", (member as MethodDeclaration).name.name); 2699 expect((member as MethodDeclaration).name.name, "foo");
2702 } 2700 }
2703 2701
2704 void test_missingIdentifier_afterAnnotation() { 2702 void test_missingIdentifier_afterAnnotation() {
2705 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]);
2706 JUnitTestCase.assertNull(method.documentationComment); 2704 expect(method.documentationComment, isNull);
2707 NodeList<Annotation> metadata = method.metadata; 2705 NodeList<Annotation> metadata = method.metadata;
2708 EngineTestCase.assertSizeOfList(1, metadata); 2706 EngineTestCase.assertSizeOfList(1, metadata);
2709 JUnitTestCase.assertEquals("override", metadata[0].name.name); 2707 expect(metadata[0].name.name, "override");
2710 } 2708 }
2711 2709
2712 void test_multiplicativeExpression_missing_LHS() { 2710 void test_multiplicativeExpression_missing_LHS() {
2713 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]); 2711 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]);
2714 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2712 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2715 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2713 expect(expression.leftOperand.isSynthetic, isTrue);
2716 } 2714 }
2717 2715
2718 void test_multiplicativeExpression_missing_LHS_RHS() { 2716 void test_multiplicativeExpression_missing_LHS_RHS() {
2719 BinaryExpression expression = ParserTestCase.parseExpression("*", [ 2717 BinaryExpression expression = ParserTestCase.parseExpression("*", [
2720 ParserErrorCode.MISSING_IDENTIFIER, 2718 ParserErrorCode.MISSING_IDENTIFIER,
2721 ParserErrorCode.MISSING_IDENTIFIER]); 2719 ParserErrorCode.MISSING_IDENTIFIER]);
2722 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2720 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2723 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2721 expect(expression.leftOperand.isSynthetic, isTrue);
2724 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2722 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2725 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2723 expect(expression.rightOperand.isSynthetic, isTrue);
2726 } 2724 }
2727 2725
2728 void test_multiplicativeExpression_missing_RHS() { 2726 void test_multiplicativeExpression_missing_RHS() {
2729 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]); 2727 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]);
2730 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2728 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2731 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2729 expect(expression.rightOperand.isSynthetic, isTrue);
2732 } 2730 }
2733 2731
2734 void test_multiplicativeExpression_missing_RHS_super() { 2732 void test_multiplicativeExpression_missing_RHS_super() {
2735 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]); 2733 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]);
2736 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2734 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2737 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2735 expect(expression.rightOperand.isSynthetic, isTrue);
2738 } 2736 }
2739 2737
2740 void test_multiplicativeExpression_precedence_unary_left() { 2738 void test_multiplicativeExpression_precedence_unary_left() {
2741 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]); 2739 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]);
2742 EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpr ession, expression.leftOperand); 2740 EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpr ession, expression.leftOperand);
2743 } 2741 }
2744 2742
2745 void test_multiplicativeExpression_precedence_unary_right() { 2743 void test_multiplicativeExpression_precedence_unary_right() {
2746 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]); 2744 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]);
2747 EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpr ession, expression.rightOperand); 2745 EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpr ession, expression.rightOperand);
2748 } 2746 }
2749 2747
2750 void test_multiplicativeExpression_super() { 2748 void test_multiplicativeExpression_super() {
2751 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ 2749 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
2752 ParserErrorCode.MISSING_IDENTIFIER, 2750 ParserErrorCode.MISSING_IDENTIFIER,
2753 ParserErrorCode.MISSING_IDENTIFIER, 2751 ParserErrorCode.MISSING_IDENTIFIER,
2754 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 2752 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
2755 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2753 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2756 } 2754 }
2757 2755
2758 void test_prefixExpression_missing_operand_minus() { 2756 void test_prefixExpression_missing_operand_minus() {
2759 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]); 2757 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]);
2760 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.operand); 2758 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.operand);
2761 JUnitTestCase.assertTrue(expression.operand.isSynthetic); 2759 expect(expression.operand.isSynthetic, isTrue);
2762 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 2760 expect(expression.operator.type, TokenType.MINUS);
2763 } 2761 }
2764 2762
2765 void test_primaryExpression_argumentDefinitionTest() { 2763 void test_primaryExpression_argumentDefinitionTest() {
2766 Expression expression = ParserTestCase.parse4("parsePrimaryExpression", "?a" , [ParserErrorCode.UNEXPECTED_TOKEN]); 2764 Expression expression = ParserTestCase.parse4("parsePrimaryExpression", "?a" , [ParserErrorCode.UNEXPECTED_TOKEN]);
2767 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression); 2765 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression);
2768 } 2766 }
2769 2767
2770 void test_relationalExpression_missing_LHS() { 2768 void test_relationalExpression_missing_LHS() {
2771 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]); 2769 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]);
2772 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.expression); 2770 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.expression);
2773 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 2771 expect(expression.expression.isSynthetic, isTrue);
2774 } 2772 }
2775 2773
2776 void test_relationalExpression_missing_LHS_RHS() { 2774 void test_relationalExpression_missing_LHS_RHS() {
2777 IsExpression expression = ParserTestCase.parseExpression("is", [ 2775 IsExpression expression = ParserTestCase.parseExpression("is", [
2778 ParserErrorCode.EXPECTED_TYPE_NAME, 2776 ParserErrorCode.EXPECTED_TYPE_NAME,
2779 ParserErrorCode.MISSING_IDENTIFIER]); 2777 ParserErrorCode.MISSING_IDENTIFIER]);
2780 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.expression); 2778 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.expression);
2781 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 2779 expect(expression.expression.isSynthetic, isTrue);
2782 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expressi on.type); 2780 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expressi on.type);
2783 JUnitTestCase.assertTrue(expression.type.isSynthetic); 2781 expect(expression.type.isSynthetic, isTrue);
2784 } 2782 }
2785 2783
2786 void test_relationalExpression_missing_RHS() { 2784 void test_relationalExpression_missing_RHS() {
2787 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]); 2785 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]);
2788 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expressi on.type); 2786 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expressi on.type);
2789 JUnitTestCase.assertTrue(expression.type.isSynthetic); 2787 expect(expression.type.isSynthetic, isTrue);
2790 } 2788 }
2791 2789
2792 void test_relationalExpression_precedence_shift_right() { 2790 void test_relationalExpression_precedence_shift_right() {
2793 IsExpression expression = ParserTestCase.parseExpression("<< is", [ 2791 IsExpression expression = ParserTestCase.parseExpression("<< is", [
2794 ParserErrorCode.EXPECTED_TYPE_NAME, 2792 ParserErrorCode.EXPECTED_TYPE_NAME,
2795 ParserErrorCode.MISSING_IDENTIFIER, 2793 ParserErrorCode.MISSING_IDENTIFIER,
2796 ParserErrorCode.MISSING_IDENTIFIER]); 2794 ParserErrorCode.MISSING_IDENTIFIER]);
2797 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.expression); 2795 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.expression);
2798 } 2796 }
2799 2797
2800 void test_shiftExpression_missing_LHS() { 2798 void test_shiftExpression_missing_LHS() {
2801 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]); 2799 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]);
2802 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2800 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2803 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2801 expect(expression.leftOperand.isSynthetic, isTrue);
2804 } 2802 }
2805 2803
2806 void test_shiftExpression_missing_LHS_RHS() { 2804 void test_shiftExpression_missing_LHS_RHS() {
2807 BinaryExpression expression = ParserTestCase.parseExpression("<<", [ 2805 BinaryExpression expression = ParserTestCase.parseExpression("<<", [
2808 ParserErrorCode.MISSING_IDENTIFIER, 2806 ParserErrorCode.MISSING_IDENTIFIER,
2809 ParserErrorCode.MISSING_IDENTIFIER]); 2807 ParserErrorCode.MISSING_IDENTIFIER]);
2810 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand); 2808 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.leftOperand);
2811 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 2809 expect(expression.leftOperand.isSynthetic, isTrue);
2812 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2810 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2813 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2811 expect(expression.rightOperand.isSynthetic, isTrue);
2814 } 2812 }
2815 2813
2816 void test_shiftExpression_missing_RHS() { 2814 void test_shiftExpression_missing_RHS() {
2817 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]); 2815 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]);
2818 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2816 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2819 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2817 expect(expression.rightOperand.isSynthetic, isTrue);
2820 } 2818 }
2821 2819
2822 void test_shiftExpression_missing_RHS_super() { 2820 void test_shiftExpression_missing_RHS_super() {
2823 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]); 2821 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]);
2824 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand); 2822 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIden tifier, expression.rightOperand);
2825 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 2823 expect(expression.rightOperand.isSynthetic, isTrue);
2826 } 2824 }
2827 2825
2828 void test_shiftExpression_precedence_unary_left() { 2826 void test_shiftExpression_precedence_unary_left() {
2829 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [ 2827 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [
2830 ParserErrorCode.MISSING_IDENTIFIER, 2828 ParserErrorCode.MISSING_IDENTIFIER,
2831 ParserErrorCode.MISSING_IDENTIFIER, 2829 ParserErrorCode.MISSING_IDENTIFIER,
2832 ParserErrorCode.MISSING_IDENTIFIER]); 2830 ParserErrorCode.MISSING_IDENTIFIER]);
2833 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand); 2831 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression.leftOperand);
2834 } 2832 }
2835 2833
(...skipping 24 matching lines...) Expand all
2860 } 2858 }
2861 2859
2862 class ResolutionCopierTest extends EngineTestCase { 2860 class ResolutionCopierTest extends EngineTestCase {
2863 void test_visitAnnotation() { 2861 void test_visitAnnotation() {
2864 String annotationName = "proxy"; 2862 String annotationName = "proxy";
2865 Annotation fromNode = AstFactory.annotation(AstFactory.identifier3(annotatio nName)); 2863 Annotation fromNode = AstFactory.annotation(AstFactory.identifier3(annotatio nName));
2866 Element element = ElementFactory.topLevelVariableElement2(annotationName); 2864 Element element = ElementFactory.topLevelVariableElement2(annotationName);
2867 fromNode.element = element; 2865 fromNode.element = element;
2868 Annotation toNode = AstFactory.annotation(AstFactory.identifier3(annotationN ame)); 2866 Annotation toNode = AstFactory.annotation(AstFactory.identifier3(annotationN ame));
2869 ResolutionCopier.copyResolutionData(fromNode, toNode); 2867 ResolutionCopier.copyResolutionData(fromNode, toNode);
2870 JUnitTestCase.assertSame(element, toNode.element); 2868 expect(toNode.element, same(element));
2871 } 2869 }
2872 2870
2873 void test_visitAsExpression() { 2871 void test_visitAsExpression() {
2874 AsExpression fromNode = AstFactory.asExpression(AstFactory.identifier3("x"), AstFactory.typeName4("A", [])); 2872 AsExpression fromNode = AstFactory.asExpression(AstFactory.identifier3("x"), AstFactory.typeName4("A", []));
2875 DartType propagatedType = ElementFactory.classElement2("A", []).type; 2873 DartType propagatedType = ElementFactory.classElement2("A", []).type;
2876 fromNode.propagatedType = propagatedType; 2874 fromNode.propagatedType = propagatedType;
2877 DartType staticType = ElementFactory.classElement2("B", []).type; 2875 DartType staticType = ElementFactory.classElement2("B", []).type;
2878 fromNode.staticType = staticType; 2876 fromNode.staticType = staticType;
2879 AsExpression toNode = AstFactory.asExpression(AstFactory.identifier3("x"), A stFactory.typeName4("A", [])); 2877 AsExpression toNode = AstFactory.asExpression(AstFactory.identifier3("x"), A stFactory.typeName4("A", []));
2880 ResolutionCopier.copyResolutionData(fromNode, toNode); 2878 ResolutionCopier.copyResolutionData(fromNode, toNode);
2881 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2879 expect(toNode.propagatedType, same(propagatedType));
2882 JUnitTestCase.assertSame(staticType, toNode.staticType); 2880 expect(toNode.staticType, same(staticType));
2883 } 2881 }
2884 2882
2885 void test_visitAssignmentExpression() { 2883 void test_visitAssignmentExpression() {
2886 AssignmentExpression fromNode = AstFactory.assignmentExpression(AstFactory.i dentifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b")); 2884 AssignmentExpression fromNode = AstFactory.assignmentExpression(AstFactory.i dentifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b"));
2887 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2885 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2888 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []); 2886 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []);
2889 fromNode.propagatedElement = propagatedElement; 2887 fromNode.propagatedElement = propagatedElement;
2890 fromNode.propagatedType = propagatedType; 2888 fromNode.propagatedType = propagatedType;
2891 DartType staticType = ElementFactory.classElement2("C", []).type; 2889 DartType staticType = ElementFactory.classElement2("C", []).type;
2892 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []); 2890 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []);
2893 fromNode.staticElement = staticElement; 2891 fromNode.staticElement = staticElement;
2894 fromNode.staticType = staticType; 2892 fromNode.staticType = staticType;
2895 AssignmentExpression toNode = AstFactory.assignmentExpression(AstFactory.ide ntifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b")); 2893 AssignmentExpression toNode = AstFactory.assignmentExpression(AstFactory.ide ntifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b"));
2896 ResolutionCopier.copyResolutionData(fromNode, toNode); 2894 ResolutionCopier.copyResolutionData(fromNode, toNode);
2897 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 2895 expect(toNode.propagatedElement, same(propagatedElement));
2898 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2896 expect(toNode.propagatedType, same(propagatedType));
2899 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 2897 expect(toNode.staticElement, same(staticElement));
2900 JUnitTestCase.assertSame(staticType, toNode.staticType); 2898 expect(toNode.staticType, same(staticType));
2901 } 2899 }
2902 2900
2903 void test_visitBinaryExpression() { 2901 void test_visitBinaryExpression() {
2904 BinaryExpression fromNode = AstFactory.binaryExpression(AstFactory.identifie r3("a"), TokenType.PLUS, AstFactory.identifier3("b")); 2902 BinaryExpression fromNode = AstFactory.binaryExpression(AstFactory.identifie r3("a"), TokenType.PLUS, AstFactory.identifier3("b"));
2905 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2903 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2906 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []); 2904 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []);
2907 fromNode.propagatedElement = propagatedElement; 2905 fromNode.propagatedElement = propagatedElement;
2908 fromNode.propagatedType = propagatedType; 2906 fromNode.propagatedType = propagatedType;
2909 DartType staticType = ElementFactory.classElement2("C", []).type; 2907 DartType staticType = ElementFactory.classElement2("C", []).type;
2910 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []); 2908 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []);
2911 fromNode.staticElement = staticElement; 2909 fromNode.staticElement = staticElement;
2912 fromNode.staticType = staticType; 2910 fromNode.staticType = staticType;
2913 BinaryExpression toNode = AstFactory.binaryExpression(AstFactory.identifier3 ("a"), TokenType.PLUS, AstFactory.identifier3("b")); 2911 BinaryExpression toNode = AstFactory.binaryExpression(AstFactory.identifier3 ("a"), TokenType.PLUS, AstFactory.identifier3("b"));
2914 ResolutionCopier.copyResolutionData(fromNode, toNode); 2912 ResolutionCopier.copyResolutionData(fromNode, toNode);
2915 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 2913 expect(toNode.propagatedElement, same(propagatedElement));
2916 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2914 expect(toNode.propagatedType, same(propagatedType));
2917 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 2915 expect(toNode.staticElement, same(staticElement));
2918 JUnitTestCase.assertSame(staticType, toNode.staticType); 2916 expect(toNode.staticType, same(staticType));
2919 } 2917 }
2920 2918
2921 void test_visitBooleanLiteral() { 2919 void test_visitBooleanLiteral() {
2922 BooleanLiteral fromNode = AstFactory.booleanLiteral(true); 2920 BooleanLiteral fromNode = AstFactory.booleanLiteral(true);
2923 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2921 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2924 fromNode.propagatedType = propagatedType; 2922 fromNode.propagatedType = propagatedType;
2925 DartType staticType = ElementFactory.classElement2("C", []).type; 2923 DartType staticType = ElementFactory.classElement2("C", []).type;
2926 fromNode.staticType = staticType; 2924 fromNode.staticType = staticType;
2927 BooleanLiteral toNode = AstFactory.booleanLiteral(true); 2925 BooleanLiteral toNode = AstFactory.booleanLiteral(true);
2928 ResolutionCopier.copyResolutionData(fromNode, toNode); 2926 ResolutionCopier.copyResolutionData(fromNode, toNode);
2929 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2927 expect(toNode.propagatedType, same(propagatedType));
2930 JUnitTestCase.assertSame(staticType, toNode.staticType); 2928 expect(toNode.staticType, same(staticType));
2931 } 2929 }
2932 2930
2933 void test_visitCascadeExpression() { 2931 void test_visitCascadeExpression() {
2934 CascadeExpression fromNode = AstFactory.cascadeExpression(AstFactory.identif ier3("a"), [AstFactory.identifier3("b")]); 2932 CascadeExpression fromNode = AstFactory.cascadeExpression(AstFactory.identif ier3("a"), [AstFactory.identifier3("b")]);
2935 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2933 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2936 fromNode.propagatedType = propagatedType; 2934 fromNode.propagatedType = propagatedType;
2937 DartType staticType = ElementFactory.classElement2("C", []).type; 2935 DartType staticType = ElementFactory.classElement2("C", []).type;
2938 fromNode.staticType = staticType; 2936 fromNode.staticType = staticType;
2939 CascadeExpression toNode = AstFactory.cascadeExpression(AstFactory.identifie r3("a"), [AstFactory.identifier3("b")]); 2937 CascadeExpression toNode = AstFactory.cascadeExpression(AstFactory.identifie r3("a"), [AstFactory.identifier3("b")]);
2940 ResolutionCopier.copyResolutionData(fromNode, toNode); 2938 ResolutionCopier.copyResolutionData(fromNode, toNode);
2941 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2939 expect(toNode.propagatedType, same(propagatedType));
2942 JUnitTestCase.assertSame(staticType, toNode.staticType); 2940 expect(toNode.staticType, same(staticType));
2943 } 2941 }
2944 2942
2945 void test_visitCompilationUnit() { 2943 void test_visitCompilationUnit() {
2946 CompilationUnit fromNode = AstFactory.compilationUnit(); 2944 CompilationUnit fromNode = AstFactory.compilationUnit();
2947 CompilationUnitElement element = new CompilationUnitElementImpl("test.dart") ; 2945 CompilationUnitElement element = new CompilationUnitElementImpl("test.dart") ;
2948 fromNode.element = element; 2946 fromNode.element = element;
2949 CompilationUnit toNode = AstFactory.compilationUnit(); 2947 CompilationUnit toNode = AstFactory.compilationUnit();
2950 ResolutionCopier.copyResolutionData(fromNode, toNode); 2948 ResolutionCopier.copyResolutionData(fromNode, toNode);
2951 JUnitTestCase.assertSame(element, toNode.element); 2949 expect(toNode.element, same(element));
2952 } 2950 }
2953 2951
2954 void test_visitConditionalExpression() { 2952 void test_visitConditionalExpression() {
2955 ConditionalExpression fromNode = AstFactory.conditionalExpression(AstFactory .identifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b")); 2953 ConditionalExpression fromNode = AstFactory.conditionalExpression(AstFactory .identifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b"));
2956 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2954 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2957 fromNode.propagatedType = propagatedType; 2955 fromNode.propagatedType = propagatedType;
2958 DartType staticType = ElementFactory.classElement2("C", []).type; 2956 DartType staticType = ElementFactory.classElement2("C", []).type;
2959 fromNode.staticType = staticType; 2957 fromNode.staticType = staticType;
2960 ConditionalExpression toNode = AstFactory.conditionalExpression(AstFactory.i dentifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b")); 2958 ConditionalExpression toNode = AstFactory.conditionalExpression(AstFactory.i dentifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b"));
2961 ResolutionCopier.copyResolutionData(fromNode, toNode); 2959 ResolutionCopier.copyResolutionData(fromNode, toNode);
2962 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2960 expect(toNode.propagatedType, same(propagatedType));
2963 JUnitTestCase.assertSame(staticType, toNode.staticType); 2961 expect(toNode.staticType, same(staticType));
2964 } 2962 }
2965 2963
2966 void test_visitConstructorDeclaration() { 2964 void test_visitConstructorDeclaration() {
2967 String className = "A"; 2965 String className = "A";
2968 String constructorName = "c"; 2966 String constructorName = "c";
2969 ConstructorDeclaration fromNode = AstFactory.constructorDeclaration(AstFacto ry.identifier3(className), constructorName, AstFactory.formalParameterList([]), null); 2967 ConstructorDeclaration fromNode = AstFactory.constructorDeclaration(AstFacto ry.identifier3(className), constructorName, AstFactory.formalParameterList([]), null);
2970 ConstructorElement element = ElementFactory.constructorElement2(ElementFacto ry.classElement2(className, []), constructorName, []); 2968 ConstructorElement element = ElementFactory.constructorElement2(ElementFacto ry.classElement2(className, []), constructorName, []);
2971 fromNode.element = element; 2969 fromNode.element = element;
2972 ConstructorDeclaration toNode = AstFactory.constructorDeclaration(AstFactory .identifier3(className), constructorName, AstFactory.formalParameterList([]), nu ll); 2970 ConstructorDeclaration toNode = AstFactory.constructorDeclaration(AstFactory .identifier3(className), constructorName, AstFactory.formalParameterList([]), nu ll);
2973 ResolutionCopier.copyResolutionData(fromNode, toNode); 2971 ResolutionCopier.copyResolutionData(fromNode, toNode);
2974 JUnitTestCase.assertSame(element, toNode.element); 2972 expect(toNode.element, same(element));
2975 } 2973 }
2976 2974
2977 void test_visitConstructorName() { 2975 void test_visitConstructorName() {
2978 ConstructorName fromNode = AstFactory.constructorName(AstFactory.typeName4(" A", []), "c"); 2976 ConstructorName fromNode = AstFactory.constructorName(AstFactory.typeName4(" A", []), "c");
2979 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("A", []), "c", []); 2977 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("A", []), "c", []);
2980 fromNode.staticElement = staticElement; 2978 fromNode.staticElement = staticElement;
2981 ConstructorName toNode = AstFactory.constructorName(AstFactory.typeName4("A" , []), "c"); 2979 ConstructorName toNode = AstFactory.constructorName(AstFactory.typeName4("A" , []), "c");
2982 ResolutionCopier.copyResolutionData(fromNode, toNode); 2980 ResolutionCopier.copyResolutionData(fromNode, toNode);
2983 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 2981 expect(toNode.staticElement, same(staticElement));
2984 } 2982 }
2985 2983
2986 void test_visitDoubleLiteral() { 2984 void test_visitDoubleLiteral() {
2987 DoubleLiteral fromNode = AstFactory.doubleLiteral(1.0); 2985 DoubleLiteral fromNode = AstFactory.doubleLiteral(1.0);
2988 DartType propagatedType = ElementFactory.classElement2("C", []).type; 2986 DartType propagatedType = ElementFactory.classElement2("C", []).type;
2989 fromNode.propagatedType = propagatedType; 2987 fromNode.propagatedType = propagatedType;
2990 DartType staticType = ElementFactory.classElement2("C", []).type; 2988 DartType staticType = ElementFactory.classElement2("C", []).type;
2991 fromNode.staticType = staticType; 2989 fromNode.staticType = staticType;
2992 DoubleLiteral toNode = AstFactory.doubleLiteral(1.0); 2990 DoubleLiteral toNode = AstFactory.doubleLiteral(1.0);
2993 ResolutionCopier.copyResolutionData(fromNode, toNode); 2991 ResolutionCopier.copyResolutionData(fromNode, toNode);
2994 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 2992 expect(toNode.propagatedType, same(propagatedType));
2995 JUnitTestCase.assertSame(staticType, toNode.staticType); 2993 expect(toNode.staticType, same(staticType));
2996 } 2994 }
2997 2995
2998 void test_visitExportDirective() { 2996 void test_visitExportDirective() {
2999 ExportDirective fromNode = AstFactory.exportDirective2("dart:uri", []); 2997 ExportDirective fromNode = AstFactory.exportDirective2("dart:uri", []);
3000 ExportElement element = new ExportElementImpl(); 2998 ExportElement element = new ExportElementImpl();
3001 fromNode.element = element; 2999 fromNode.element = element;
3002 ExportDirective toNode = AstFactory.exportDirective2("dart:uri", []); 3000 ExportDirective toNode = AstFactory.exportDirective2("dart:uri", []);
3003 ResolutionCopier.copyResolutionData(fromNode, toNode); 3001 ResolutionCopier.copyResolutionData(fromNode, toNode);
3004 JUnitTestCase.assertSame(element, toNode.element); 3002 expect(toNode.element, same(element));
3005 } 3003 }
3006 3004
3007 void test_visitFunctionExpression() { 3005 void test_visitFunctionExpression() {
3008 FunctionExpression fromNode = AstFactory.functionExpression2(AstFactory.form alParameterList([]), AstFactory.emptyFunctionBody()); 3006 FunctionExpression fromNode = AstFactory.functionExpression2(AstFactory.form alParameterList([]), AstFactory.emptyFunctionBody());
3009 MethodElement element = ElementFactory.methodElement("m", ElementFactory.cla ssElement2("C", []).type, []); 3007 MethodElement element = ElementFactory.methodElement("m", ElementFactory.cla ssElement2("C", []).type, []);
3010 fromNode.element = element; 3008 fromNode.element = element;
3011 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3009 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3012 fromNode.propagatedType = propagatedType; 3010 fromNode.propagatedType = propagatedType;
3013 DartType staticType = ElementFactory.classElement2("C", []).type; 3011 DartType staticType = ElementFactory.classElement2("C", []).type;
3014 fromNode.staticType = staticType; 3012 fromNode.staticType = staticType;
3015 FunctionExpression toNode = AstFactory.functionExpression2(AstFactory.formal ParameterList([]), AstFactory.emptyFunctionBody()); 3013 FunctionExpression toNode = AstFactory.functionExpression2(AstFactory.formal ParameterList([]), AstFactory.emptyFunctionBody());
3016 ResolutionCopier.copyResolutionData(fromNode, toNode); 3014 ResolutionCopier.copyResolutionData(fromNode, toNode);
3017 JUnitTestCase.assertSame(element, toNode.element); 3015 expect(toNode.element, same(element));
3018 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3016 expect(toNode.propagatedType, same(propagatedType));
3019 JUnitTestCase.assertSame(staticType, toNode.staticType); 3017 expect(toNode.staticType, same(staticType));
3020 } 3018 }
3021 3019
3022 void test_visitFunctionExpressionInvocation() { 3020 void test_visitFunctionExpressionInvocation() {
3023 FunctionExpressionInvocation fromNode = AstFactory.functionExpressionInvocat ion(AstFactory.identifier3("f"), []); 3021 FunctionExpressionInvocation fromNode = AstFactory.functionExpressionInvocat ion(AstFactory.identifier3("f"), []);
3024 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 3022 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
3025 fromNode.propagatedElement = propagatedElement; 3023 fromNode.propagatedElement = propagatedElement;
3026 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3024 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3027 fromNode.propagatedType = propagatedType; 3025 fromNode.propagatedType = propagatedType;
3028 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 3026 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
3029 fromNode.staticElement = staticElement; 3027 fromNode.staticElement = staticElement;
3030 DartType staticType = ElementFactory.classElement2("C", []).type; 3028 DartType staticType = ElementFactory.classElement2("C", []).type;
3031 fromNode.staticType = staticType; 3029 fromNode.staticType = staticType;
3032 FunctionExpressionInvocation toNode = AstFactory.functionExpressionInvocatio n(AstFactory.identifier3("f"), []); 3030 FunctionExpressionInvocation toNode = AstFactory.functionExpressionInvocatio n(AstFactory.identifier3("f"), []);
3033 ResolutionCopier.copyResolutionData(fromNode, toNode); 3031 ResolutionCopier.copyResolutionData(fromNode, toNode);
3034 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 3032 expect(toNode.propagatedElement, same(propagatedElement));
3035 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3033 expect(toNode.propagatedType, same(propagatedType));
3036 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3034 expect(toNode.staticElement, same(staticElement));
3037 JUnitTestCase.assertSame(staticType, toNode.staticType); 3035 expect(toNode.staticType, same(staticType));
3038 } 3036 }
3039 3037
3040 void test_visitImportDirective() { 3038 void test_visitImportDirective() {
3041 ImportDirective fromNode = AstFactory.importDirective3("dart:uri", null, []) ; 3039 ImportDirective fromNode = AstFactory.importDirective3("dart:uri", null, []) ;
3042 ImportElement element = new ImportElementImpl(0); 3040 ImportElement element = new ImportElementImpl(0);
3043 fromNode.element = element; 3041 fromNode.element = element;
3044 ImportDirective toNode = AstFactory.importDirective3("dart:uri", null, []); 3042 ImportDirective toNode = AstFactory.importDirective3("dart:uri", null, []);
3045 ResolutionCopier.copyResolutionData(fromNode, toNode); 3043 ResolutionCopier.copyResolutionData(fromNode, toNode);
3046 JUnitTestCase.assertSame(element, toNode.element); 3044 expect(toNode.element, same(element));
3047 } 3045 }
3048 3046
3049 void test_visitIndexExpression() { 3047 void test_visitIndexExpression() {
3050 IndexExpression fromNode = AstFactory.indexExpression(AstFactory.identifier3 ("a"), AstFactory.integer(0)); 3048 IndexExpression fromNode = AstFactory.indexExpression(AstFactory.identifier3 ("a"), AstFactory.integer(0));
3051 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 3049 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
3052 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 3050 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
3053 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement); 3051 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement);
3054 fromNode.auxiliaryElements = auxiliaryElements; 3052 fromNode.auxiliaryElements = auxiliaryElements;
3055 fromNode.propagatedElement = propagatedElement; 3053 fromNode.propagatedElement = propagatedElement;
3056 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3054 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3057 fromNode.propagatedType = propagatedType; 3055 fromNode.propagatedType = propagatedType;
3058 fromNode.staticElement = staticElement; 3056 fromNode.staticElement = staticElement;
3059 DartType staticType = ElementFactory.classElement2("C", []).type; 3057 DartType staticType = ElementFactory.classElement2("C", []).type;
3060 fromNode.staticType = staticType; 3058 fromNode.staticType = staticType;
3061 IndexExpression toNode = AstFactory.indexExpression(AstFactory.identifier3(" a"), AstFactory.integer(0)); 3059 IndexExpression toNode = AstFactory.indexExpression(AstFactory.identifier3(" a"), AstFactory.integer(0));
3062 ResolutionCopier.copyResolutionData(fromNode, toNode); 3060 ResolutionCopier.copyResolutionData(fromNode, toNode);
3063 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements); 3061 expect(toNode.auxiliaryElements, same(auxiliaryElements));
3064 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 3062 expect(toNode.propagatedElement, same(propagatedElement));
3065 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3063 expect(toNode.propagatedType, same(propagatedType));
3066 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3064 expect(toNode.staticElement, same(staticElement));
3067 JUnitTestCase.assertSame(staticType, toNode.staticType); 3065 expect(toNode.staticType, same(staticType));
3068 } 3066 }
3069 3067
3070 void test_visitInstanceCreationExpression() { 3068 void test_visitInstanceCreationExpression() {
3071 InstanceCreationExpression fromNode = AstFactory.instanceCreationExpression2 (Keyword.NEW, AstFactory.typeName4("C", []), []); 3069 InstanceCreationExpression fromNode = AstFactory.instanceCreationExpression2 (Keyword.NEW, AstFactory.typeName4("C", []), []);
3072 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3070 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3073 fromNode.propagatedType = propagatedType; 3071 fromNode.propagatedType = propagatedType;
3074 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []); 3072 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
3075 fromNode.staticElement = staticElement; 3073 fromNode.staticElement = staticElement;
3076 DartType staticType = ElementFactory.classElement2("C", []).type; 3074 DartType staticType = ElementFactory.classElement2("C", []).type;
3077 fromNode.staticType = staticType; 3075 fromNode.staticType = staticType;
3078 InstanceCreationExpression toNode = AstFactory.instanceCreationExpression2(K eyword.NEW, AstFactory.typeName4("C", []), []); 3076 InstanceCreationExpression toNode = AstFactory.instanceCreationExpression2(K eyword.NEW, AstFactory.typeName4("C", []), []);
3079 ResolutionCopier.copyResolutionData(fromNode, toNode); 3077 ResolutionCopier.copyResolutionData(fromNode, toNode);
3080 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3078 expect(toNode.propagatedType, same(propagatedType));
3081 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3079 expect(toNode.staticElement, same(staticElement));
3082 JUnitTestCase.assertSame(staticType, toNode.staticType); 3080 expect(toNode.staticType, same(staticType));
3083 } 3081 }
3084 3082
3085 void test_visitIntegerLiteral() { 3083 void test_visitIntegerLiteral() {
3086 IntegerLiteral fromNode = AstFactory.integer(2); 3084 IntegerLiteral fromNode = AstFactory.integer(2);
3087 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3085 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3088 fromNode.propagatedType = propagatedType; 3086 fromNode.propagatedType = propagatedType;
3089 DartType staticType = ElementFactory.classElement2("C", []).type; 3087 DartType staticType = ElementFactory.classElement2("C", []).type;
3090 fromNode.staticType = staticType; 3088 fromNode.staticType = staticType;
3091 IntegerLiteral toNode = AstFactory.integer(2); 3089 IntegerLiteral toNode = AstFactory.integer(2);
3092 ResolutionCopier.copyResolutionData(fromNode, toNode); 3090 ResolutionCopier.copyResolutionData(fromNode, toNode);
3093 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3091 expect(toNode.propagatedType, same(propagatedType));
3094 JUnitTestCase.assertSame(staticType, toNode.staticType); 3092 expect(toNode.staticType, same(staticType));
3095 } 3093 }
3096 3094
3097 void test_visitIsExpression() { 3095 void test_visitIsExpression() {
3098 IsExpression fromNode = AstFactory.isExpression(AstFactory.identifier3("x"), false, AstFactory.typeName4("A", [])); 3096 IsExpression fromNode = AstFactory.isExpression(AstFactory.identifier3("x"), false, AstFactory.typeName4("A", []));
3099 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3097 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3100 fromNode.propagatedType = propagatedType; 3098 fromNode.propagatedType = propagatedType;
3101 DartType staticType = ElementFactory.classElement2("C", []).type; 3099 DartType staticType = ElementFactory.classElement2("C", []).type;
3102 fromNode.staticType = staticType; 3100 fromNode.staticType = staticType;
3103 IsExpression toNode = AstFactory.isExpression(AstFactory.identifier3("x"), f alse, AstFactory.typeName4("A", [])); 3101 IsExpression toNode = AstFactory.isExpression(AstFactory.identifier3("x"), f alse, AstFactory.typeName4("A", []));
3104 ResolutionCopier.copyResolutionData(fromNode, toNode); 3102 ResolutionCopier.copyResolutionData(fromNode, toNode);
3105 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3103 expect(toNode.propagatedType, same(propagatedType));
3106 JUnitTestCase.assertSame(staticType, toNode.staticType); 3104 expect(toNode.staticType, same(staticType));
3107 } 3105 }
3108 3106
3109 void test_visitLibraryIdentifier() { 3107 void test_visitLibraryIdentifier() {
3110 LibraryIdentifier fromNode = AstFactory.libraryIdentifier([AstFactory.identi fier3("lib")]); 3108 LibraryIdentifier fromNode = AstFactory.libraryIdentifier([AstFactory.identi fier3("lib")]);
3111 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3109 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3112 fromNode.propagatedType = propagatedType; 3110 fromNode.propagatedType = propagatedType;
3113 DartType staticType = ElementFactory.classElement2("C", []).type; 3111 DartType staticType = ElementFactory.classElement2("C", []).type;
3114 fromNode.staticType = staticType; 3112 fromNode.staticType = staticType;
3115 LibraryIdentifier toNode = AstFactory.libraryIdentifier([AstFactory.identifi er3("lib")]); 3113 LibraryIdentifier toNode = AstFactory.libraryIdentifier([AstFactory.identifi er3("lib")]);
3116 ResolutionCopier.copyResolutionData(fromNode, toNode); 3114 ResolutionCopier.copyResolutionData(fromNode, toNode);
3117 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3115 expect(toNode.propagatedType, same(propagatedType));
3118 JUnitTestCase.assertSame(staticType, toNode.staticType); 3116 expect(toNode.staticType, same(staticType));
3119 } 3117 }
3120 3118
3121 void test_visitListLiteral() { 3119 void test_visitListLiteral() {
3122 ListLiteral fromNode = AstFactory.listLiteral([]); 3120 ListLiteral fromNode = AstFactory.listLiteral([]);
3123 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3121 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3124 fromNode.propagatedType = propagatedType; 3122 fromNode.propagatedType = propagatedType;
3125 DartType staticType = ElementFactory.classElement2("C", []).type; 3123 DartType staticType = ElementFactory.classElement2("C", []).type;
3126 fromNode.staticType = staticType; 3124 fromNode.staticType = staticType;
3127 ListLiteral toNode = AstFactory.listLiteral([]); 3125 ListLiteral toNode = AstFactory.listLiteral([]);
3128 ResolutionCopier.copyResolutionData(fromNode, toNode); 3126 ResolutionCopier.copyResolutionData(fromNode, toNode);
3129 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3127 expect(toNode.propagatedType, same(propagatedType));
3130 JUnitTestCase.assertSame(staticType, toNode.staticType); 3128 expect(toNode.staticType, same(staticType));
3131 } 3129 }
3132 3130
3133 void test_visitMapLiteral() { 3131 void test_visitMapLiteral() {
3134 MapLiteral fromNode = AstFactory.mapLiteral2([]); 3132 MapLiteral fromNode = AstFactory.mapLiteral2([]);
3135 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3133 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3136 fromNode.propagatedType = propagatedType; 3134 fromNode.propagatedType = propagatedType;
3137 DartType staticType = ElementFactory.classElement2("C", []).type; 3135 DartType staticType = ElementFactory.classElement2("C", []).type;
3138 fromNode.staticType = staticType; 3136 fromNode.staticType = staticType;
3139 MapLiteral toNode = AstFactory.mapLiteral2([]); 3137 MapLiteral toNode = AstFactory.mapLiteral2([]);
3140 ResolutionCopier.copyResolutionData(fromNode, toNode); 3138 ResolutionCopier.copyResolutionData(fromNode, toNode);
3141 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3139 expect(toNode.propagatedType, same(propagatedType));
3142 JUnitTestCase.assertSame(staticType, toNode.staticType); 3140 expect(toNode.staticType, same(staticType));
3143 } 3141 }
3144 3142
3145 void test_visitMethodInvocation() { 3143 void test_visitMethodInvocation() {
3146 MethodInvocation fromNode = AstFactory.methodInvocation2("m", []); 3144 MethodInvocation fromNode = AstFactory.methodInvocation2("m", []);
3147 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3145 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3148 fromNode.propagatedType = propagatedType; 3146 fromNode.propagatedType = propagatedType;
3149 DartType staticType = ElementFactory.classElement2("C", []).type; 3147 DartType staticType = ElementFactory.classElement2("C", []).type;
3150 fromNode.staticType = staticType; 3148 fromNode.staticType = staticType;
3151 MethodInvocation toNode = AstFactory.methodInvocation2("m", []); 3149 MethodInvocation toNode = AstFactory.methodInvocation2("m", []);
3152 ResolutionCopier.copyResolutionData(fromNode, toNode); 3150 ResolutionCopier.copyResolutionData(fromNode, toNode);
3153 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3151 expect(toNode.propagatedType, same(propagatedType));
3154 JUnitTestCase.assertSame(staticType, toNode.staticType); 3152 expect(toNode.staticType, same(staticType));
3155 } 3153 }
3156 3154
3157 void test_visitNamedExpression() { 3155 void test_visitNamedExpression() {
3158 NamedExpression fromNode = AstFactory.namedExpression2("n", AstFactory.integ er(0)); 3156 NamedExpression fromNode = AstFactory.namedExpression2("n", AstFactory.integ er(0));
3159 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3157 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3160 fromNode.propagatedType = propagatedType; 3158 fromNode.propagatedType = propagatedType;
3161 DartType staticType = ElementFactory.classElement2("C", []).type; 3159 DartType staticType = ElementFactory.classElement2("C", []).type;
3162 fromNode.staticType = staticType; 3160 fromNode.staticType = staticType;
3163 NamedExpression toNode = AstFactory.namedExpression2("n", AstFactory.integer (0)); 3161 NamedExpression toNode = AstFactory.namedExpression2("n", AstFactory.integer (0));
3164 ResolutionCopier.copyResolutionData(fromNode, toNode); 3162 ResolutionCopier.copyResolutionData(fromNode, toNode);
3165 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3163 expect(toNode.propagatedType, same(propagatedType));
3166 JUnitTestCase.assertSame(staticType, toNode.staticType); 3164 expect(toNode.staticType, same(staticType));
3167 } 3165 }
3168 3166
3169 void test_visitNullLiteral() { 3167 void test_visitNullLiteral() {
3170 NullLiteral fromNode = AstFactory.nullLiteral(); 3168 NullLiteral fromNode = AstFactory.nullLiteral();
3171 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3169 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3172 fromNode.propagatedType = propagatedType; 3170 fromNode.propagatedType = propagatedType;
3173 DartType staticType = ElementFactory.classElement2("C", []).type; 3171 DartType staticType = ElementFactory.classElement2("C", []).type;
3174 fromNode.staticType = staticType; 3172 fromNode.staticType = staticType;
3175 NullLiteral toNode = AstFactory.nullLiteral(); 3173 NullLiteral toNode = AstFactory.nullLiteral();
3176 ResolutionCopier.copyResolutionData(fromNode, toNode); 3174 ResolutionCopier.copyResolutionData(fromNode, toNode);
3177 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3175 expect(toNode.propagatedType, same(propagatedType));
3178 JUnitTestCase.assertSame(staticType, toNode.staticType); 3176 expect(toNode.staticType, same(staticType));
3179 } 3177 }
3180 3178
3181 void test_visitParenthesizedExpression() { 3179 void test_visitParenthesizedExpression() {
3182 ParenthesizedExpression fromNode = AstFactory.parenthesizedExpression(AstFac tory.integer(0)); 3180 ParenthesizedExpression fromNode = AstFactory.parenthesizedExpression(AstFac tory.integer(0));
3183 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3181 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3184 fromNode.propagatedType = propagatedType; 3182 fromNode.propagatedType = propagatedType;
3185 DartType staticType = ElementFactory.classElement2("C", []).type; 3183 DartType staticType = ElementFactory.classElement2("C", []).type;
3186 fromNode.staticType = staticType; 3184 fromNode.staticType = staticType;
3187 ParenthesizedExpression toNode = AstFactory.parenthesizedExpression(AstFacto ry.integer(0)); 3185 ParenthesizedExpression toNode = AstFactory.parenthesizedExpression(AstFacto ry.integer(0));
3188 ResolutionCopier.copyResolutionData(fromNode, toNode); 3186 ResolutionCopier.copyResolutionData(fromNode, toNode);
3189 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3187 expect(toNode.propagatedType, same(propagatedType));
3190 JUnitTestCase.assertSame(staticType, toNode.staticType); 3188 expect(toNode.staticType, same(staticType));
3191 } 3189 }
3192 3190
3193 void test_visitPartDirective() { 3191 void test_visitPartDirective() {
3194 PartDirective fromNode = AstFactory.partDirective2("part.dart"); 3192 PartDirective fromNode = AstFactory.partDirective2("part.dart");
3195 LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.lib raryIdentifier2(["lib"])); 3193 LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.lib raryIdentifier2(["lib"]));
3196 fromNode.element = element; 3194 fromNode.element = element;
3197 PartDirective toNode = AstFactory.partDirective2("part.dart"); 3195 PartDirective toNode = AstFactory.partDirective2("part.dart");
3198 ResolutionCopier.copyResolutionData(fromNode, toNode); 3196 ResolutionCopier.copyResolutionData(fromNode, toNode);
3199 JUnitTestCase.assertSame(element, toNode.element); 3197 expect(toNode.element, same(element));
3200 } 3198 }
3201 3199
3202 void test_visitPartOfDirective() { 3200 void test_visitPartOfDirective() {
3203 PartOfDirective fromNode = AstFactory.partOfDirective(AstFactory.libraryIden tifier2(["lib"])); 3201 PartOfDirective fromNode = AstFactory.partOfDirective(AstFactory.libraryIden tifier2(["lib"]));
3204 LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.lib raryIdentifier2(["lib"])); 3202 LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.lib raryIdentifier2(["lib"]));
3205 fromNode.element = element; 3203 fromNode.element = element;
3206 PartOfDirective toNode = AstFactory.partOfDirective(AstFactory.libraryIdenti fier2(["lib"])); 3204 PartOfDirective toNode = AstFactory.partOfDirective(AstFactory.libraryIdenti fier2(["lib"]));
3207 ResolutionCopier.copyResolutionData(fromNode, toNode); 3205 ResolutionCopier.copyResolutionData(fromNode, toNode);
3208 JUnitTestCase.assertSame(element, toNode.element); 3206 expect(toNode.element, same(element));
3209 } 3207 }
3210 3208
3211 void test_visitPostfixExpression() { 3209 void test_visitPostfixExpression() {
3212 String variableName = "x"; 3210 String variableName = "x";
3213 PostfixExpression fromNode = AstFactory.postfixExpression(AstFactory.identif ier3(variableName), TokenType.PLUS_PLUS); 3211 PostfixExpression fromNode = AstFactory.postfixExpression(AstFactory.identif ier3(variableName), TokenType.PLUS_PLUS);
3214 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []); 3212 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []);
3215 fromNode.propagatedElement = propagatedElement; 3213 fromNode.propagatedElement = propagatedElement;
3216 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3214 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3217 fromNode.propagatedType = propagatedType; 3215 fromNode.propagatedType = propagatedType;
3218 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []); 3216 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []);
3219 fromNode.staticElement = staticElement; 3217 fromNode.staticElement = staticElement;
3220 DartType staticType = ElementFactory.classElement2("C", []).type; 3218 DartType staticType = ElementFactory.classElement2("C", []).type;
3221 fromNode.staticType = staticType; 3219 fromNode.staticType = staticType;
3222 PostfixExpression toNode = AstFactory.postfixExpression(AstFactory.identifie r3(variableName), TokenType.PLUS_PLUS); 3220 PostfixExpression toNode = AstFactory.postfixExpression(AstFactory.identifie r3(variableName), TokenType.PLUS_PLUS);
3223 ResolutionCopier.copyResolutionData(fromNode, toNode); 3221 ResolutionCopier.copyResolutionData(fromNode, toNode);
3224 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 3222 expect(toNode.propagatedElement, same(propagatedElement));
3225 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3223 expect(toNode.propagatedType, same(propagatedType));
3226 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3224 expect(toNode.staticElement, same(staticElement));
3227 JUnitTestCase.assertSame(staticType, toNode.staticType); 3225 expect(toNode.staticType, same(staticType));
3228 } 3226 }
3229 3227
3230 void test_visitPrefixedIdentifier() { 3228 void test_visitPrefixedIdentifier() {
3231 PrefixedIdentifier fromNode = AstFactory.identifier5("p", "f"); 3229 PrefixedIdentifier fromNode = AstFactory.identifier5("p", "f");
3232 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3230 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3233 fromNode.propagatedType = propagatedType; 3231 fromNode.propagatedType = propagatedType;
3234 DartType staticType = ElementFactory.classElement2("C", []).type; 3232 DartType staticType = ElementFactory.classElement2("C", []).type;
3235 fromNode.staticType = staticType; 3233 fromNode.staticType = staticType;
3236 PrefixedIdentifier toNode = AstFactory.identifier5("p", "f"); 3234 PrefixedIdentifier toNode = AstFactory.identifier5("p", "f");
3237 ResolutionCopier.copyResolutionData(fromNode, toNode); 3235 ResolutionCopier.copyResolutionData(fromNode, toNode);
3238 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3236 expect(toNode.propagatedType, same(propagatedType));
3239 JUnitTestCase.assertSame(staticType, toNode.staticType); 3237 expect(toNode.staticType, same(staticType));
3240 } 3238 }
3241 3239
3242 void test_visitPrefixExpression() { 3240 void test_visitPrefixExpression() {
3243 PrefixExpression fromNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x")); 3241 PrefixExpression fromNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
3244 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []); 3242 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []);
3245 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3243 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3246 fromNode.propagatedElement = propagatedElement; 3244 fromNode.propagatedElement = propagatedElement;
3247 fromNode.propagatedType = propagatedType; 3245 fromNode.propagatedType = propagatedType;
3248 DartType staticType = ElementFactory.classElement2("C", []).type; 3246 DartType staticType = ElementFactory.classElement2("C", []).type;
3249 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []); 3247 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []);
3250 fromNode.staticElement = staticElement; 3248 fromNode.staticElement = staticElement;
3251 fromNode.staticType = staticType; 3249 fromNode.staticType = staticType;
3252 PrefixExpression toNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, A stFactory.identifier3("x")); 3250 PrefixExpression toNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, A stFactory.identifier3("x"));
3253 ResolutionCopier.copyResolutionData(fromNode, toNode); 3251 ResolutionCopier.copyResolutionData(fromNode, toNode);
3254 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 3252 expect(toNode.propagatedElement, same(propagatedElement));
3255 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3253 expect(toNode.propagatedType, same(propagatedType));
3256 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3254 expect(toNode.staticElement, same(staticElement));
3257 JUnitTestCase.assertSame(staticType, toNode.staticType); 3255 expect(toNode.staticType, same(staticType));
3258 } 3256 }
3259 3257
3260 void test_visitPropertyAccess() { 3258 void test_visitPropertyAccess() {
3261 PropertyAccess fromNode = AstFactory.propertyAccess2(AstFactory.identifier3( "x"), "y"); 3259 PropertyAccess fromNode = AstFactory.propertyAccess2(AstFactory.identifier3( "x"), "y");
3262 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3260 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3263 fromNode.propagatedType = propagatedType; 3261 fromNode.propagatedType = propagatedType;
3264 DartType staticType = ElementFactory.classElement2("C", []).type; 3262 DartType staticType = ElementFactory.classElement2("C", []).type;
3265 fromNode.staticType = staticType; 3263 fromNode.staticType = staticType;
3266 PropertyAccess toNode = AstFactory.propertyAccess2(AstFactory.identifier3("x "), "y"); 3264 PropertyAccess toNode = AstFactory.propertyAccess2(AstFactory.identifier3("x "), "y");
3267 ResolutionCopier.copyResolutionData(fromNode, toNode); 3265 ResolutionCopier.copyResolutionData(fromNode, toNode);
3268 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3266 expect(toNode.propagatedType, same(propagatedType));
3269 JUnitTestCase.assertSame(staticType, toNode.staticType); 3267 expect(toNode.staticType, same(staticType));
3270 } 3268 }
3271 3269
3272 void test_visitRedirectingConstructorInvocation() { 3270 void test_visitRedirectingConstructorInvocation() {
3273 RedirectingConstructorInvocation fromNode = AstFactory.redirectingConstructo rInvocation([]); 3271 RedirectingConstructorInvocation fromNode = AstFactory.redirectingConstructo rInvocation([]);
3274 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []); 3272 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
3275 fromNode.staticElement = staticElement; 3273 fromNode.staticElement = staticElement;
3276 RedirectingConstructorInvocation toNode = AstFactory.redirectingConstructorI nvocation([]); 3274 RedirectingConstructorInvocation toNode = AstFactory.redirectingConstructorI nvocation([]);
3277 ResolutionCopier.copyResolutionData(fromNode, toNode); 3275 ResolutionCopier.copyResolutionData(fromNode, toNode);
3278 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3276 expect(toNode.staticElement, same(staticElement));
3279 } 3277 }
3280 3278
3281 void test_visitRethrowExpression() { 3279 void test_visitRethrowExpression() {
3282 RethrowExpression fromNode = AstFactory.rethrowExpression(); 3280 RethrowExpression fromNode = AstFactory.rethrowExpression();
3283 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3281 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3284 fromNode.propagatedType = propagatedType; 3282 fromNode.propagatedType = propagatedType;
3285 DartType staticType = ElementFactory.classElement2("C", []).type; 3283 DartType staticType = ElementFactory.classElement2("C", []).type;
3286 fromNode.staticType = staticType; 3284 fromNode.staticType = staticType;
3287 RethrowExpression toNode = AstFactory.rethrowExpression(); 3285 RethrowExpression toNode = AstFactory.rethrowExpression();
3288 ResolutionCopier.copyResolutionData(fromNode, toNode); 3286 ResolutionCopier.copyResolutionData(fromNode, toNode);
3289 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3287 expect(toNode.propagatedType, same(propagatedType));
3290 JUnitTestCase.assertSame(staticType, toNode.staticType); 3288 expect(toNode.staticType, same(staticType));
3291 } 3289 }
3292 3290
3293 void test_visitSimpleIdentifier() { 3291 void test_visitSimpleIdentifier() {
3294 SimpleIdentifier fromNode = AstFactory.identifier3("x"); 3292 SimpleIdentifier fromNode = AstFactory.identifier3("x");
3295 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 3293 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
3296 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 3294 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
3297 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement); 3295 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement);
3298 fromNode.auxiliaryElements = auxiliaryElements; 3296 fromNode.auxiliaryElements = auxiliaryElements;
3299 fromNode.propagatedElement = propagatedElement; 3297 fromNode.propagatedElement = propagatedElement;
3300 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3298 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3301 fromNode.propagatedType = propagatedType; 3299 fromNode.propagatedType = propagatedType;
3302 fromNode.staticElement = staticElement; 3300 fromNode.staticElement = staticElement;
3303 DartType staticType = ElementFactory.classElement2("C", []).type; 3301 DartType staticType = ElementFactory.classElement2("C", []).type;
3304 fromNode.staticType = staticType; 3302 fromNode.staticType = staticType;
3305 SimpleIdentifier toNode = AstFactory.identifier3("x"); 3303 SimpleIdentifier toNode = AstFactory.identifier3("x");
3306 ResolutionCopier.copyResolutionData(fromNode, toNode); 3304 ResolutionCopier.copyResolutionData(fromNode, toNode);
3307 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements); 3305 expect(toNode.auxiliaryElements, same(auxiliaryElements));
3308 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 3306 expect(toNode.propagatedElement, same(propagatedElement));
3309 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3307 expect(toNode.propagatedType, same(propagatedType));
3310 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3308 expect(toNode.staticElement, same(staticElement));
3311 JUnitTestCase.assertSame(staticType, toNode.staticType); 3309 expect(toNode.staticType, same(staticType));
3312 } 3310 }
3313 3311
3314 void test_visitSimpleStringLiteral() { 3312 void test_visitSimpleStringLiteral() {
3315 SimpleStringLiteral fromNode = AstFactory.string2("abc"); 3313 SimpleStringLiteral fromNode = AstFactory.string2("abc");
3316 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3314 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3317 fromNode.propagatedType = propagatedType; 3315 fromNode.propagatedType = propagatedType;
3318 DartType staticType = ElementFactory.classElement2("C", []).type; 3316 DartType staticType = ElementFactory.classElement2("C", []).type;
3319 fromNode.staticType = staticType; 3317 fromNode.staticType = staticType;
3320 SimpleStringLiteral toNode = AstFactory.string2("abc"); 3318 SimpleStringLiteral toNode = AstFactory.string2("abc");
3321 ResolutionCopier.copyResolutionData(fromNode, toNode); 3319 ResolutionCopier.copyResolutionData(fromNode, toNode);
3322 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3320 expect(toNode.propagatedType, same(propagatedType));
3323 JUnitTestCase.assertSame(staticType, toNode.staticType); 3321 expect(toNode.staticType, same(staticType));
3324 } 3322 }
3325 3323
3326 void test_visitStringInterpolation() { 3324 void test_visitStringInterpolation() {
3327 StringInterpolation fromNode = AstFactory.string([AstFactory.interpolationSt ring("a", "'a'")]); 3325 StringInterpolation fromNode = AstFactory.string([AstFactory.interpolationSt ring("a", "'a'")]);
3328 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3326 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3329 fromNode.propagatedType = propagatedType; 3327 fromNode.propagatedType = propagatedType;
3330 DartType staticType = ElementFactory.classElement2("C", []).type; 3328 DartType staticType = ElementFactory.classElement2("C", []).type;
3331 fromNode.staticType = staticType; 3329 fromNode.staticType = staticType;
3332 StringInterpolation toNode = AstFactory.string([AstFactory.interpolationStri ng("a", "'a'")]); 3330 StringInterpolation toNode = AstFactory.string([AstFactory.interpolationStri ng("a", "'a'")]);
3333 ResolutionCopier.copyResolutionData(fromNode, toNode); 3331 ResolutionCopier.copyResolutionData(fromNode, toNode);
3334 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3332 expect(toNode.propagatedType, same(propagatedType));
3335 JUnitTestCase.assertSame(staticType, toNode.staticType); 3333 expect(toNode.staticType, same(staticType));
3336 } 3334 }
3337 3335
3338 void test_visitSuperConstructorInvocation() { 3336 void test_visitSuperConstructorInvocation() {
3339 SuperConstructorInvocation fromNode = AstFactory.superConstructorInvocation( []); 3337 SuperConstructorInvocation fromNode = AstFactory.superConstructorInvocation( []);
3340 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []); 3338 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
3341 fromNode.staticElement = staticElement; 3339 fromNode.staticElement = staticElement;
3342 SuperConstructorInvocation toNode = AstFactory.superConstructorInvocation([] ); 3340 SuperConstructorInvocation toNode = AstFactory.superConstructorInvocation([] );
3343 ResolutionCopier.copyResolutionData(fromNode, toNode); 3341 ResolutionCopier.copyResolutionData(fromNode, toNode);
3344 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 3342 expect(toNode.staticElement, same(staticElement));
3345 } 3343 }
3346 3344
3347 void test_visitSuperExpression() { 3345 void test_visitSuperExpression() {
3348 SuperExpression fromNode = AstFactory.superExpression(); 3346 SuperExpression fromNode = AstFactory.superExpression();
3349 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3347 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3350 fromNode.propagatedType = propagatedType; 3348 fromNode.propagatedType = propagatedType;
3351 DartType staticType = ElementFactory.classElement2("C", []).type; 3349 DartType staticType = ElementFactory.classElement2("C", []).type;
3352 fromNode.staticType = staticType; 3350 fromNode.staticType = staticType;
3353 SuperExpression toNode = AstFactory.superExpression(); 3351 SuperExpression toNode = AstFactory.superExpression();
3354 ResolutionCopier.copyResolutionData(fromNode, toNode); 3352 ResolutionCopier.copyResolutionData(fromNode, toNode);
3355 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3353 expect(toNode.propagatedType, same(propagatedType));
3356 JUnitTestCase.assertSame(staticType, toNode.staticType); 3354 expect(toNode.staticType, same(staticType));
3357 } 3355 }
3358 3356
3359 void test_visitSymbolLiteral() { 3357 void test_visitSymbolLiteral() {
3360 SymbolLiteral fromNode = AstFactory.symbolLiteral(["s"]); 3358 SymbolLiteral fromNode = AstFactory.symbolLiteral(["s"]);
3361 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3359 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3362 fromNode.propagatedType = propagatedType; 3360 fromNode.propagatedType = propagatedType;
3363 DartType staticType = ElementFactory.classElement2("C", []).type; 3361 DartType staticType = ElementFactory.classElement2("C", []).type;
3364 fromNode.staticType = staticType; 3362 fromNode.staticType = staticType;
3365 SymbolLiteral toNode = AstFactory.symbolLiteral(["s"]); 3363 SymbolLiteral toNode = AstFactory.symbolLiteral(["s"]);
3366 ResolutionCopier.copyResolutionData(fromNode, toNode); 3364 ResolutionCopier.copyResolutionData(fromNode, toNode);
3367 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3365 expect(toNode.propagatedType, same(propagatedType));
3368 JUnitTestCase.assertSame(staticType, toNode.staticType); 3366 expect(toNode.staticType, same(staticType));
3369 } 3367 }
3370 3368
3371 void test_visitThisExpression() { 3369 void test_visitThisExpression() {
3372 ThisExpression fromNode = AstFactory.thisExpression(); 3370 ThisExpression fromNode = AstFactory.thisExpression();
3373 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3371 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3374 fromNode.propagatedType = propagatedType; 3372 fromNode.propagatedType = propagatedType;
3375 DartType staticType = ElementFactory.classElement2("C", []).type; 3373 DartType staticType = ElementFactory.classElement2("C", []).type;
3376 fromNode.staticType = staticType; 3374 fromNode.staticType = staticType;
3377 ThisExpression toNode = AstFactory.thisExpression(); 3375 ThisExpression toNode = AstFactory.thisExpression();
3378 ResolutionCopier.copyResolutionData(fromNode, toNode); 3376 ResolutionCopier.copyResolutionData(fromNode, toNode);
3379 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3377 expect(toNode.propagatedType, same(propagatedType));
3380 JUnitTestCase.assertSame(staticType, toNode.staticType); 3378 expect(toNode.staticType, same(staticType));
3381 } 3379 }
3382 3380
3383 void test_visitThrowExpression() { 3381 void test_visitThrowExpression() {
3384 ThrowExpression fromNode = AstFactory.throwExpression(); 3382 ThrowExpression fromNode = AstFactory.throwExpression();
3385 DartType propagatedType = ElementFactory.classElement2("C", []).type; 3383 DartType propagatedType = ElementFactory.classElement2("C", []).type;
3386 fromNode.propagatedType = propagatedType; 3384 fromNode.propagatedType = propagatedType;
3387 DartType staticType = ElementFactory.classElement2("C", []).type; 3385 DartType staticType = ElementFactory.classElement2("C", []).type;
3388 fromNode.staticType = staticType; 3386 fromNode.staticType = staticType;
3389 ThrowExpression toNode = AstFactory.throwExpression(); 3387 ThrowExpression toNode = AstFactory.throwExpression();
3390 ResolutionCopier.copyResolutionData(fromNode, toNode); 3388 ResolutionCopier.copyResolutionData(fromNode, toNode);
3391 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 3389 expect(toNode.propagatedType, same(propagatedType));
3392 JUnitTestCase.assertSame(staticType, toNode.staticType); 3390 expect(toNode.staticType, same(staticType));
3393 } 3391 }
3394 3392
3395 void test_visitTypeName() { 3393 void test_visitTypeName() {
3396 TypeName fromNode = AstFactory.typeName4("C", []); 3394 TypeName fromNode = AstFactory.typeName4("C", []);
3397 DartType type = ElementFactory.classElement2("C", []).type; 3395 DartType type = ElementFactory.classElement2("C", []).type;
3398 fromNode.type = type; 3396 fromNode.type = type;
3399 TypeName toNode = AstFactory.typeName4("C", []); 3397 TypeName toNode = AstFactory.typeName4("C", []);
3400 ResolutionCopier.copyResolutionData(fromNode, toNode); 3398 ResolutionCopier.copyResolutionData(fromNode, toNode);
3401 JUnitTestCase.assertSame(type, toNode.type); 3399 expect(toNode.type, same(type));
3402 } 3400 }
3403 } 3401 }
3404 3402
3405 /** 3403 /**
3406 * The class `SimpleParserTest` defines parser tests that test individual parsin g method. The 3404 * The class `SimpleParserTest` defines parser tests that test individual parsin g method. The
3407 * code fragments should be as minimal as possible in order to test the method, but should not test 3405 * code fragments should be as minimal as possible in order to test the method, but should not test
3408 * the interactions between the method under test and other methods. 3406 * the interactions between the method under test and other methods.
3409 * 3407 *
3410 * More complex tests should be defined in the class [ComplexParserTest]. 3408 * More complex tests should be defined in the class [ComplexParserTest].
3411 */ 3409 */
3412 class SimpleParserTest extends ParserTestCase { 3410 class SimpleParserTest extends ParserTestCase {
3413 void fail_parseCommentReference_this() { 3411 void fail_parseCommentReference_this() {
3414 // This fails because we are returning null from the method and asserting th at the return value 3412 // This fails because we are returning null from the method and asserting th at the return value
3415 // is not null. 3413 // is not null.
3416 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], ""); 3414 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], "");
3417 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier); 3415 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier);
3418 JUnitTestCase.assertNotNull(identifier.token); 3416 expect(identifier.token, isNotNull);
3419 JUnitTestCase.assertEquals("a", identifier.name); 3417 expect(identifier.name, "a");
3420 JUnitTestCase.assertEquals(5, identifier.offset); 3418 expect(identifier.offset, 5);
3421 } 3419 }
3422 3420
3423 void test_computeStringValue_emptyInterpolationPrefix() { 3421 void test_computeStringValue_emptyInterpolationPrefix() {
3424 JUnitTestCase.assertEquals("", _computeStringValue("'''", true, false)); 3422 expect(_computeStringValue("'''", true, false), "");
3425 } 3423 }
3426 3424
3427 void test_computeStringValue_escape_b() { 3425 void test_computeStringValue_escape_b() {
3428 JUnitTestCase.assertEquals("\b", _computeStringValue("'\\b'", true, true)); 3426 expect(_computeStringValue("'\\b'", true, true), "\b");
3429 } 3427 }
3430 3428
3431 void test_computeStringValue_escape_f() { 3429 void test_computeStringValue_escape_f() {
3432 JUnitTestCase.assertEquals("\f", _computeStringValue("'\\f'", true, true)); 3430 expect(_computeStringValue("'\\f'", true, true), "\f");
3433 } 3431 }
3434 3432
3435 void test_computeStringValue_escape_n() { 3433 void test_computeStringValue_escape_n() {
3436 JUnitTestCase.assertEquals("\n", _computeStringValue("'\\n'", true, true)); 3434 expect(_computeStringValue("'\\n'", true, true), "\n");
3437 } 3435 }
3438 3436
3439 void test_computeStringValue_escape_notSpecial() { 3437 void test_computeStringValue_escape_notSpecial() {
3440 JUnitTestCase.assertEquals(":", _computeStringValue("'\\:'", true, true)); 3438 expect(_computeStringValue("'\\:'", true, true), ":");
3441 } 3439 }
3442 3440
3443 void test_computeStringValue_escape_r() { 3441 void test_computeStringValue_escape_r() {
3444 JUnitTestCase.assertEquals("\r", _computeStringValue("'\\r'", true, true)); 3442 expect(_computeStringValue("'\\r'", true, true), "\r");
3445 } 3443 }
3446 3444
3447 void test_computeStringValue_escape_t() { 3445 void test_computeStringValue_escape_t() {
3448 JUnitTestCase.assertEquals("\t", _computeStringValue("'\\t'", true, true)); 3446 expect(_computeStringValue("'\\t'", true, true), "\t");
3449 } 3447 }
3450 3448
3451 void test_computeStringValue_escape_u_fixed() { 3449 void test_computeStringValue_escape_u_fixed() {
3452 JUnitTestCase.assertEquals("\u4321", _computeStringValue("'\\u4321'", true, true)); 3450 expect(_computeStringValue("'\\u4321'", true, true), "\u4321");
3453 } 3451 }
3454 3452
3455 void test_computeStringValue_escape_u_variable() { 3453 void test_computeStringValue_escape_u_variable() {
3456 JUnitTestCase.assertEquals("\u0123", _computeStringValue("'\\u{123}'", true, true)); 3454 expect(_computeStringValue("'\\u{123}'", true, true), "\u0123");
3457 } 3455 }
3458 3456
3459 void test_computeStringValue_escape_v() { 3457 void test_computeStringValue_escape_v() {
3460 JUnitTestCase.assertEquals("\u000B", _computeStringValue("'\\v'", true, true )); 3458 expect(_computeStringValue("'\\v'", true, true), "\u000B");
3461 } 3459 }
3462 3460
3463 void test_computeStringValue_escape_x() { 3461 void test_computeStringValue_escape_x() {
3464 JUnitTestCase.assertEquals("\u00FF", _computeStringValue("'\\xFF'", true, tr ue)); 3462 expect(_computeStringValue("'\\xFF'", true, true), "\u00FF");
3465 } 3463 }
3466 3464
3467 void test_computeStringValue_noEscape_single() { 3465 void test_computeStringValue_noEscape_single() {
3468 JUnitTestCase.assertEquals("text", _computeStringValue("'text'", true, true) ); 3466 expect(_computeStringValue("'text'", true, true), "text");
3469 } 3467 }
3470 3468
3471 void test_computeStringValue_noEscape_triple() { 3469 void test_computeStringValue_noEscape_triple() {
3472 JUnitTestCase.assertEquals("text", _computeStringValue("'''text'''", true, t rue)); 3470 expect(_computeStringValue("'''text'''", true, true), "text");
3473 } 3471 }
3474 3472
3475 void test_computeStringValue_raw_single() { 3473 void test_computeStringValue_raw_single() {
3476 JUnitTestCase.assertEquals("text", _computeStringValue("r'text'", true, true )); 3474 expect(_computeStringValue("r'text'", true, true), "text");
3477 } 3475 }
3478 3476
3479 void test_computeStringValue_raw_triple() { 3477 void test_computeStringValue_raw_triple() {
3480 JUnitTestCase.assertEquals("text", _computeStringValue("r'''text'''", true, true)); 3478 expect(_computeStringValue("r'''text'''", true, true), "text");
3481 } 3479 }
3482 3480
3483 void test_computeStringValue_raw_withEscape() { 3481 void test_computeStringValue_raw_withEscape() {
3484 JUnitTestCase.assertEquals("two\\nlines", _computeStringValue("r'two\\nlines '", true, true)); 3482 expect(_computeStringValue("r'two\\nlines'", true, true), "two\\nlines");
3485 } 3483 }
3486 3484
3487 void test_computeStringValue_triple_internalQuote_first_empty() { 3485 void test_computeStringValue_triple_internalQuote_first_empty() {
3488 JUnitTestCase.assertEquals("'", _computeStringValue("''''", true, false)); 3486 expect(_computeStringValue("''''", true, false), "'");
3489 } 3487 }
3490 3488
3491 void test_computeStringValue_triple_internalQuote_first_nonEmpty() { 3489 void test_computeStringValue_triple_internalQuote_first_nonEmpty() {
3492 JUnitTestCase.assertEquals("'text", _computeStringValue("''''text", true, fa lse)); 3490 expect(_computeStringValue("''''text", true, false), "'text");
3493 } 3491 }
3494 3492
3495 void test_computeStringValue_triple_internalQuote_last_empty() { 3493 void test_computeStringValue_triple_internalQuote_last_empty() {
3496 JUnitTestCase.assertEquals("", _computeStringValue("'''", false, true)); 3494 expect(_computeStringValue("'''", false, true), "");
3497 } 3495 }
3498 3496
3499 void test_computeStringValue_triple_internalQuote_last_nonEmpty() { 3497 void test_computeStringValue_triple_internalQuote_last_nonEmpty() {
3500 JUnitTestCase.assertEquals("text", _computeStringValue("text'''", false, tru e)); 3498 expect(_computeStringValue("text'''", false, true), "text");
3501 } 3499 }
3502 3500
3503 void test_constFactory() { 3501 void test_constFactory() {
3504 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;"); 3502 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
3505 } 3503 }
3506 3504
3507 void test_createSyntheticIdentifier() { 3505 void test_createSyntheticIdentifier() {
3508 SimpleIdentifier identifier = _createSyntheticIdentifier(); 3506 SimpleIdentifier identifier = _createSyntheticIdentifier();
3509 JUnitTestCase.assertTrue(identifier.isSynthetic); 3507 expect(identifier.isSynthetic, isTrue);
3510 } 3508 }
3511 3509
3512 void test_createSyntheticStringLiteral() { 3510 void test_createSyntheticStringLiteral() {
3513 SimpleStringLiteral literal = _createSyntheticStringLiteral(); 3511 SimpleStringLiteral literal = _createSyntheticStringLiteral();
3514 JUnitTestCase.assertTrue(literal.isSynthetic); 3512 expect(literal.isSynthetic, isTrue);
3515 } 3513 }
3516 3514
3517 void test_function_literal_allowed_at_toplevel() { 3515 void test_function_literal_allowed_at_toplevel() {
3518 ParserTestCase.parseCompilationUnit("var x = () {};", []); 3516 ParserTestCase.parseCompilationUnit("var x = () {};", []);
3519 } 3517 }
3520 3518
3521 void test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitiali zer() { 3519 void test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitiali zer() {
3522 ParserTestCase.parseCompilationUnit("class C { C() : a = f(() {}); }", []); 3520 ParserTestCase.parseCompilationUnit("class C { C() : a = f(() {}); }", []);
3523 } 3521 }
3524 3522
(...skipping 11 matching lines...) Expand all
3536 3534
3537 void test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFi eldInitializer() { 3535 void test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFi eldInitializer() {
3538 ParserTestCase.parseCompilationUnit("class C { C() : a = (() {}); }", []); 3536 ParserTestCase.parseCompilationUnit("class C { C() : a = (() {}); }", []);
3539 } 3537 }
3540 3538
3541 void test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldI nitializer() { 3539 void test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldI nitializer() {
3542 ParserTestCase.parseCompilationUnit("class C { C() : a = \"\${(){}}\"; }", [ ]); 3540 ParserTestCase.parseCompilationUnit("class C { C() : a = \"\${(){}}\"; }", [ ]);
3543 } 3541 }
3544 3542
3545 void test_isFunctionDeclaration_nameButNoReturn_block() { 3543 void test_isFunctionDeclaration_nameButNoReturn_block() {
3546 JUnitTestCase.assertTrue(_isFunctionDeclaration("f() {}")); 3544 expect(_isFunctionDeclaration("f() {}"), isTrue);
3547 } 3545 }
3548 3546
3549 void test_isFunctionDeclaration_nameButNoReturn_expression() { 3547 void test_isFunctionDeclaration_nameButNoReturn_expression() {
3550 JUnitTestCase.assertTrue(_isFunctionDeclaration("f() => e")); 3548 expect(_isFunctionDeclaration("f() => e"), isTrue);
3551 } 3549 }
3552 3550
3553 void test_isFunctionDeclaration_normalReturn_block() { 3551 void test_isFunctionDeclaration_normalReturn_block() {
3554 JUnitTestCase.assertTrue(_isFunctionDeclaration("C f() {}")); 3552 expect(_isFunctionDeclaration("C f() {}"), isTrue);
3555 } 3553 }
3556 3554
3557 void test_isFunctionDeclaration_normalReturn_expression() { 3555 void test_isFunctionDeclaration_normalReturn_expression() {
3558 JUnitTestCase.assertTrue(_isFunctionDeclaration("C f() => e")); 3556 expect(_isFunctionDeclaration("C f() => e"), isTrue);
3559 } 3557 }
3560 3558
3561 void test_isFunctionDeclaration_voidReturn_block() { 3559 void test_isFunctionDeclaration_voidReturn_block() {
3562 JUnitTestCase.assertTrue(_isFunctionDeclaration("void f() {}")); 3560 expect(_isFunctionDeclaration("void f() {}"), isTrue);
3563 } 3561 }
3564 3562
3565 void test_isFunctionDeclaration_voidReturn_expression() { 3563 void test_isFunctionDeclaration_voidReturn_expression() {
3566 JUnitTestCase.assertTrue(_isFunctionDeclaration("void f() => e")); 3564 expect(_isFunctionDeclaration("void f() => e"), isTrue);
3567 } 3565 }
3568 3566
3569 void test_isFunctionExpression_false_noBody() { 3567 void test_isFunctionExpression_false_noBody() {
3570 JUnitTestCase.assertFalse(_isFunctionExpression("f();")); 3568 expect(_isFunctionExpression("f();"), isFalse);
3571 } 3569 }
3572 3570
3573 void test_isFunctionExpression_false_notParameters() { 3571 void test_isFunctionExpression_false_notParameters() {
3574 JUnitTestCase.assertFalse(_isFunctionExpression("(a + b) {")); 3572 expect(_isFunctionExpression("(a + b) {"), isFalse);
3575 } 3573 }
3576 3574
3577 void test_isFunctionExpression_noName_block() { 3575 void test_isFunctionExpression_noName_block() {
3578 JUnitTestCase.assertTrue(_isFunctionExpression("() {}")); 3576 expect(_isFunctionExpression("() {}"), isTrue);
3579 } 3577 }
3580 3578
3581 void test_isFunctionExpression_noName_expression() { 3579 void test_isFunctionExpression_noName_expression() {
3582 JUnitTestCase.assertTrue(_isFunctionExpression("() => e")); 3580 expect(_isFunctionExpression("() => e"), isTrue);
3583 } 3581 }
3584 3582
3585 void test_isFunctionExpression_parameter_final() { 3583 void test_isFunctionExpression_parameter_final() {
3586 JUnitTestCase.assertTrue(_isFunctionExpression("(final a) {}")); 3584 expect(_isFunctionExpression("(final a) {}"), isTrue);
3587 JUnitTestCase.assertTrue(_isFunctionExpression("(final a, b) {}")); 3585 expect(_isFunctionExpression("(final a, b) {}"), isTrue);
3588 JUnitTestCase.assertTrue(_isFunctionExpression("(final a, final b) {}")); 3586 expect(_isFunctionExpression("(final a, final b) {}"), isTrue);
3589 } 3587 }
3590 3588
3591 void test_isFunctionExpression_parameter_final_typed() { 3589 void test_isFunctionExpression_parameter_final_typed() {
3592 JUnitTestCase.assertTrue(_isFunctionExpression("(final int a) {}")); 3590 expect(_isFunctionExpression("(final int a) {}"), isTrue);
3593 JUnitTestCase.assertTrue(_isFunctionExpression("(final prefix.List a) {}")); 3591 expect(_isFunctionExpression("(final prefix.List a) {}"), isTrue);
3594 JUnitTestCase.assertTrue(_isFunctionExpression("(final List<int> a) {}")); 3592 expect(_isFunctionExpression("(final List<int> a) {}"), isTrue);
3595 JUnitTestCase.assertTrue(_isFunctionExpression("(final prefix.List<int> a) { }")); 3593 expect(_isFunctionExpression("(final prefix.List<int> a) {}"), isTrue);
3596 } 3594 }
3597 3595
3598 void test_isFunctionExpression_parameter_multiple() { 3596 void test_isFunctionExpression_parameter_multiple() {
3599 JUnitTestCase.assertTrue(_isFunctionExpression("(a, b) {}")); 3597 expect(_isFunctionExpression("(a, b) {}"), isTrue);
3600 } 3598 }
3601 3599
3602 void test_isFunctionExpression_parameter_named() { 3600 void test_isFunctionExpression_parameter_named() {
3603 JUnitTestCase.assertTrue(_isFunctionExpression("({a}) {}")); 3601 expect(_isFunctionExpression("({a}) {}"), isTrue);
3604 } 3602 }
3605 3603
3606 void test_isFunctionExpression_parameter_optional() { 3604 void test_isFunctionExpression_parameter_optional() {
3607 JUnitTestCase.assertTrue(_isFunctionExpression("([a]) {}")); 3605 expect(_isFunctionExpression("([a]) {}"), isTrue);
3608 } 3606 }
3609 3607
3610 void test_isFunctionExpression_parameter_single() { 3608 void test_isFunctionExpression_parameter_single() {
3611 JUnitTestCase.assertTrue(_isFunctionExpression("(a) {}")); 3609 expect(_isFunctionExpression("(a) {}"), isTrue);
3612 } 3610 }
3613 3611
3614 void test_isFunctionExpression_parameter_typed() { 3612 void test_isFunctionExpression_parameter_typed() {
3615 JUnitTestCase.assertTrue(_isFunctionExpression("(int a, int b) {}")); 3613 expect(_isFunctionExpression("(int a, int b) {}"), isTrue);
3616 } 3614 }
3617 3615
3618 void test_isInitializedVariableDeclaration_assignment() { 3616 void test_isInitializedVariableDeclaration_assignment() {
3619 JUnitTestCase.assertFalse(_isInitializedVariableDeclaration("a = null;")); 3617 expect(_isInitializedVariableDeclaration("a = null;"), isFalse);
3620 } 3618 }
3621 3619
3622 void test_isInitializedVariableDeclaration_comparison() { 3620 void test_isInitializedVariableDeclaration_comparison() {
3623 JUnitTestCase.assertFalse(_isInitializedVariableDeclaration("a < 0;")); 3621 expect(_isInitializedVariableDeclaration("a < 0;"), isFalse);
3624 } 3622 }
3625 3623
3626 void test_isInitializedVariableDeclaration_conditional() { 3624 void test_isInitializedVariableDeclaration_conditional() {
3627 JUnitTestCase.assertFalse(_isInitializedVariableDeclaration("a == null ? ini t() : update();")); 3625 expect(_isInitializedVariableDeclaration("a == null ? init() : update();"), isFalse);
3628 } 3626 }
3629 3627
3630 void test_isInitializedVariableDeclaration_const_noType_initialized() { 3628 void test_isInitializedVariableDeclaration_const_noType_initialized() {
3631 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("const a = 0;")); 3629 expect(_isInitializedVariableDeclaration("const a = 0;"), isTrue);
3632 } 3630 }
3633 3631
3634 void test_isInitializedVariableDeclaration_const_noType_uninitialized() { 3632 void test_isInitializedVariableDeclaration_const_noType_uninitialized() {
3635 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("const a;")); 3633 expect(_isInitializedVariableDeclaration("const a;"), isTrue);
3636 } 3634 }
3637 3635
3638 void test_isInitializedVariableDeclaration_const_simpleType_uninitialized() { 3636 void test_isInitializedVariableDeclaration_const_simpleType_uninitialized() {
3639 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("const A a;")); 3637 expect(_isInitializedVariableDeclaration("const A a;"), isTrue);
3640 } 3638 }
3641 3639
3642 void test_isInitializedVariableDeclaration_final_noType_initialized() { 3640 void test_isInitializedVariableDeclaration_final_noType_initialized() {
3643 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("final a = 0;")); 3641 expect(_isInitializedVariableDeclaration("final a = 0;"), isTrue);
3644 } 3642 }
3645 3643
3646 void test_isInitializedVariableDeclaration_final_noType_uninitialized() { 3644 void test_isInitializedVariableDeclaration_final_noType_uninitialized() {
3647 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("final a;")); 3645 expect(_isInitializedVariableDeclaration("final a;"), isTrue);
3648 } 3646 }
3649 3647
3650 void test_isInitializedVariableDeclaration_final_simpleType_initialized() { 3648 void test_isInitializedVariableDeclaration_final_simpleType_initialized() {
3651 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("final A a = 0;") ); 3649 expect(_isInitializedVariableDeclaration("final A a = 0;"), isTrue);
3652 } 3650 }
3653 3651
3654 void test_isInitializedVariableDeclaration_functionDeclaration_typed() { 3652 void test_isInitializedVariableDeclaration_functionDeclaration_typed() {
3655 JUnitTestCase.assertFalse(_isInitializedVariableDeclaration("A f() {};")); 3653 expect(_isInitializedVariableDeclaration("A f() {};"), isFalse);
3656 } 3654 }
3657 3655
3658 void test_isInitializedVariableDeclaration_functionDeclaration_untyped() { 3656 void test_isInitializedVariableDeclaration_functionDeclaration_untyped() {
3659 JUnitTestCase.assertFalse(_isInitializedVariableDeclaration("f() {};")); 3657 expect(_isInitializedVariableDeclaration("f() {};"), isFalse);
3660 } 3658 }
3661 3659
3662 void test_isInitializedVariableDeclaration_noType_initialized() { 3660 void test_isInitializedVariableDeclaration_noType_initialized() {
3663 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("var a = 0;")); 3661 expect(_isInitializedVariableDeclaration("var a = 0;"), isTrue);
3664 } 3662 }
3665 3663
3666 void test_isInitializedVariableDeclaration_noType_uninitialized() { 3664 void test_isInitializedVariableDeclaration_noType_uninitialized() {
3667 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("var a;")); 3665 expect(_isInitializedVariableDeclaration("var a;"), isTrue);
3668 } 3666 }
3669 3667
3670 void test_isInitializedVariableDeclaration_parameterizedType_initialized() { 3668 void test_isInitializedVariableDeclaration_parameterizedType_initialized() {
3671 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("List<int> a = nu ll;")); 3669 expect(_isInitializedVariableDeclaration("List<int> a = null;"), isTrue);
3672 } 3670 }
3673 3671
3674 void test_isInitializedVariableDeclaration_parameterizedType_uninitialized() { 3672 void test_isInitializedVariableDeclaration_parameterizedType_uninitialized() {
3675 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("List<int> a;")); 3673 expect(_isInitializedVariableDeclaration("List<int> a;"), isTrue);
3676 } 3674 }
3677 3675
3678 void test_isInitializedVariableDeclaration_simpleType_initialized() { 3676 void test_isInitializedVariableDeclaration_simpleType_initialized() {
3679 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("A a = 0;")); 3677 expect(_isInitializedVariableDeclaration("A a = 0;"), isTrue);
3680 } 3678 }
3681 3679
3682 void test_isInitializedVariableDeclaration_simpleType_uninitialized() { 3680 void test_isInitializedVariableDeclaration_simpleType_uninitialized() {
3683 JUnitTestCase.assertTrue(_isInitializedVariableDeclaration("A a;")); 3681 expect(_isInitializedVariableDeclaration("A a;"), isTrue);
3684 } 3682 }
3685 3683
3686 void test_isSwitchMember_case_labeled() { 3684 void test_isSwitchMember_case_labeled() {
3687 JUnitTestCase.assertTrue(_isSwitchMember("l1: l2: case")); 3685 expect(_isSwitchMember("l1: l2: case"), isTrue);
3688 } 3686 }
3689 3687
3690 void test_isSwitchMember_case_unlabeled() { 3688 void test_isSwitchMember_case_unlabeled() {
3691 JUnitTestCase.assertTrue(_isSwitchMember("case")); 3689 expect(_isSwitchMember("case"), isTrue);
3692 } 3690 }
3693 3691
3694 void test_isSwitchMember_default_labeled() { 3692 void test_isSwitchMember_default_labeled() {
3695 JUnitTestCase.assertTrue(_isSwitchMember("l1: l2: default")); 3693 expect(_isSwitchMember("l1: l2: default"), isTrue);
3696 } 3694 }
3697 3695
3698 void test_isSwitchMember_default_unlabeled() { 3696 void test_isSwitchMember_default_unlabeled() {
3699 JUnitTestCase.assertTrue(_isSwitchMember("default")); 3697 expect(_isSwitchMember("default"), isTrue);
3700 } 3698 }
3701 3699
3702 void test_isSwitchMember_false() { 3700 void test_isSwitchMember_false() {
3703 JUnitTestCase.assertFalse(_isSwitchMember("break;")); 3701 expect(_isSwitchMember("break;"), isFalse);
3704 } 3702 }
3705 3703
3706 void test_parseAdditiveExpression_normal() { 3704 void test_parseAdditiveExpression_normal() {
3707 BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression ", "x + y", []); 3705 BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression ", "x + y", []);
3708 JUnitTestCase.assertNotNull(expression.leftOperand); 3706 expect(expression.leftOperand, isNotNull);
3709 JUnitTestCase.assertNotNull(expression.operator); 3707 expect(expression.operator, isNotNull);
3710 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type); 3708 expect(expression.operator.type, TokenType.PLUS);
3711 JUnitTestCase.assertNotNull(expression.rightOperand); 3709 expect(expression.rightOperand, isNotNull);
3712 } 3710 }
3713 3711
3714 void test_parseAdditiveExpression_super() { 3712 void test_parseAdditiveExpression_super() {
3715 BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression ", "super + y", []); 3713 BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression ", "super + y", []);
3716 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 3714 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
3717 JUnitTestCase.assertNotNull(expression.operator); 3715 expect(expression.operator, isNotNull);
3718 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type); 3716 expect(expression.operator.type, TokenType.PLUS);
3719 JUnitTestCase.assertNotNull(expression.rightOperand); 3717 expect(expression.rightOperand, isNotNull);
3720 } 3718 }
3721 3719
3722 void test_parseAnnotation_n1() { 3720 void test_parseAnnotation_n1() {
3723 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A", []); 3721 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A", []);
3724 JUnitTestCase.assertNotNull(annotation.atSign); 3722 expect(annotation.atSign, isNotNull);
3725 JUnitTestCase.assertNotNull(annotation.name); 3723 expect(annotation.name, isNotNull);
3726 JUnitTestCase.assertNull(annotation.period); 3724 expect(annotation.period, isNull);
3727 JUnitTestCase.assertNull(annotation.constructorName); 3725 expect(annotation.constructorName, isNull);
3728 JUnitTestCase.assertNull(annotation.arguments); 3726 expect(annotation.arguments, isNull);
3729 } 3727 }
3730 3728
3731 void test_parseAnnotation_n1_a() { 3729 void test_parseAnnotation_n1_a() {
3732 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A(x,y)", []); 3730 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A(x,y)", []);
3733 JUnitTestCase.assertNotNull(annotation.atSign); 3731 expect(annotation.atSign, isNotNull);
3734 JUnitTestCase.assertNotNull(annotation.name); 3732 expect(annotation.name, isNotNull);
3735 JUnitTestCase.assertNull(annotation.period); 3733 expect(annotation.period, isNull);
3736 JUnitTestCase.assertNull(annotation.constructorName); 3734 expect(annotation.constructorName, isNull);
3737 JUnitTestCase.assertNotNull(annotation.arguments); 3735 expect(annotation.arguments, isNotNull);
3738 } 3736 }
3739 3737
3740 void test_parseAnnotation_n2() { 3738 void test_parseAnnotation_n2() {
3741 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B", []) ; 3739 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B", []) ;
3742 JUnitTestCase.assertNotNull(annotation.atSign); 3740 expect(annotation.atSign, isNotNull);
3743 JUnitTestCase.assertNotNull(annotation.name); 3741 expect(annotation.name, isNotNull);
3744 JUnitTestCase.assertNull(annotation.period); 3742 expect(annotation.period, isNull);
3745 JUnitTestCase.assertNull(annotation.constructorName); 3743 expect(annotation.constructorName, isNull);
3746 JUnitTestCase.assertNull(annotation.arguments); 3744 expect(annotation.arguments, isNull);
3747 } 3745 }
3748 3746
3749 void test_parseAnnotation_n2_a() { 3747 void test_parseAnnotation_n2_a() {
3750 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B(x,y)" , []); 3748 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B(x,y)" , []);
3751 JUnitTestCase.assertNotNull(annotation.atSign); 3749 expect(annotation.atSign, isNotNull);
3752 JUnitTestCase.assertNotNull(annotation.name); 3750 expect(annotation.name, isNotNull);
3753 JUnitTestCase.assertNull(annotation.period); 3751 expect(annotation.period, isNull);
3754 JUnitTestCase.assertNull(annotation.constructorName); 3752 expect(annotation.constructorName, isNull);
3755 JUnitTestCase.assertNotNull(annotation.arguments); 3753 expect(annotation.arguments, isNotNull);
3756 } 3754 }
3757 3755
3758 void test_parseAnnotation_n3() { 3756 void test_parseAnnotation_n3() {
3759 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C", [ ]); 3757 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C", [ ]);
3760 JUnitTestCase.assertNotNull(annotation.atSign); 3758 expect(annotation.atSign, isNotNull);
3761 JUnitTestCase.assertNotNull(annotation.name); 3759 expect(annotation.name, isNotNull);
3762 JUnitTestCase.assertNotNull(annotation.period); 3760 expect(annotation.period, isNotNull);
3763 JUnitTestCase.assertNotNull(annotation.constructorName); 3761 expect(annotation.constructorName, isNotNull);
3764 JUnitTestCase.assertNull(annotation.arguments); 3762 expect(annotation.arguments, isNull);
3765 } 3763 }
3766 3764
3767 void test_parseAnnotation_n3_a() { 3765 void test_parseAnnotation_n3_a() {
3768 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C(x,y )", []); 3766 Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C(x,y )", []);
3769 JUnitTestCase.assertNotNull(annotation.atSign); 3767 expect(annotation.atSign, isNotNull);
3770 JUnitTestCase.assertNotNull(annotation.name); 3768 expect(annotation.name, isNotNull);
3771 JUnitTestCase.assertNotNull(annotation.period); 3769 expect(annotation.period, isNotNull);
3772 JUnitTestCase.assertNotNull(annotation.constructorName); 3770 expect(annotation.constructorName, isNotNull);
3773 JUnitTestCase.assertNotNull(annotation.arguments); 3771 expect(annotation.arguments, isNotNull);
3774 } 3772 }
3775 3773
3776 void test_parseArgument_named() { 3774 void test_parseArgument_named() {
3777 NamedExpression expression = ParserTestCase.parse4("parseArgument", "n: x", []); 3775 NamedExpression expression = ParserTestCase.parse4("parseArgument", "n: x", []);
3778 Label name = expression.name; 3776 Label name = expression.name;
3779 JUnitTestCase.assertNotNull(name); 3777 expect(name, isNotNull);
3780 JUnitTestCase.assertNotNull(name.label); 3778 expect(name.label, isNotNull);
3781 JUnitTestCase.assertNotNull(name.colon); 3779 expect(name.colon, isNotNull);
3782 JUnitTestCase.assertNotNull(expression.expression); 3780 expect(expression.expression, isNotNull);
3783 } 3781 }
3784 3782
3785 void test_parseArgument_unnamed() { 3783 void test_parseArgument_unnamed() {
3786 String lexeme = "x"; 3784 String lexeme = "x";
3787 SimpleIdentifier identifier = ParserTestCase.parse4("parseArgument", lexeme, []); 3785 SimpleIdentifier identifier = ParserTestCase.parse4("parseArgument", lexeme, []);
3788 JUnitTestCase.assertEquals(lexeme, identifier.name); 3786 expect(identifier.name, lexeme);
3789 } 3787 }
3790 3788
3791 void test_parseArgumentList_empty() { 3789 void test_parseArgumentList_empty() {
3792 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "()", []); 3790 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "()", []);
3793 NodeList<Expression> arguments = argumentList.arguments; 3791 NodeList<Expression> arguments = argumentList.arguments;
3794 EngineTestCase.assertSizeOfList(0, arguments); 3792 EngineTestCase.assertSizeOfList(0, arguments);
3795 } 3793 }
3796 3794
3797 void test_parseArgumentList_mixed() { 3795 void test_parseArgumentList_mixed() {
3798 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(w, x, y: y, z: z)", []); 3796 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(w, x, y: y, z: z)", []);
3799 NodeList<Expression> arguments = argumentList.arguments; 3797 NodeList<Expression> arguments = argumentList.arguments;
3800 EngineTestCase.assertSizeOfList(4, arguments); 3798 EngineTestCase.assertSizeOfList(4, arguments);
3801 } 3799 }
3802 3800
3803 void test_parseArgumentList_noNamed() { 3801 void test_parseArgumentList_noNamed() {
3804 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x, y, z)", []); 3802 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x, y, z)", []);
3805 NodeList<Expression> arguments = argumentList.arguments; 3803 NodeList<Expression> arguments = argumentList.arguments;
3806 EngineTestCase.assertSizeOfList(3, arguments); 3804 EngineTestCase.assertSizeOfList(3, arguments);
3807 } 3805 }
3808 3806
3809 void test_parseArgumentList_onlyNamed() { 3807 void test_parseArgumentList_onlyNamed() {
3810 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x: x, y: y)", []); 3808 ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "(x: x, y: y)", []);
3811 NodeList<Expression> arguments = argumentList.arguments; 3809 NodeList<Expression> arguments = argumentList.arguments;
3812 EngineTestCase.assertSizeOfList(2, arguments); 3810 EngineTestCase.assertSizeOfList(2, arguments);
3813 } 3811 }
3814 3812
3815 void test_parseAssertStatement() { 3813 void test_parseAssertStatement() {
3816 AssertStatement statement = ParserTestCase.parse4("parseAssertStatement", "a ssert (x);", []); 3814 AssertStatement statement = ParserTestCase.parse4("parseAssertStatement", "a ssert (x);", []);
3817 JUnitTestCase.assertNotNull(statement.keyword); 3815 expect(statement.keyword, isNotNull);
3818 JUnitTestCase.assertNotNull(statement.leftParenthesis); 3816 expect(statement.leftParenthesis, isNotNull);
3819 JUnitTestCase.assertNotNull(statement.condition); 3817 expect(statement.condition, isNotNull);
3820 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3818 expect(statement.rightParenthesis, isNotNull);
3821 JUnitTestCase.assertNotNull(statement.semicolon); 3819 expect(statement.semicolon, isNotNull);
3822 } 3820 }
3823 3821
3824 void test_parseAssignableExpression_expression_args_dot() { 3822 void test_parseAssignableExpression_expression_args_dot() {
3825 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z"); 3823 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z");
3826 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation; 3824 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation;
3827 JUnitTestCase.assertNotNull(invocation.function); 3825 expect(invocation.function, isNotNull);
3828 ArgumentList argumentList = invocation.argumentList; 3826 ArgumentList argumentList = invocation.argumentList;
3829 JUnitTestCase.assertNotNull(argumentList); 3827 expect(argumentList, isNotNull);
3830 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 3828 EngineTestCase.assertSizeOfList(1, argumentList.arguments);
3831 JUnitTestCase.assertNotNull(propertyAccess.operator); 3829 expect(propertyAccess.operator, isNotNull);
3832 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3830 expect(propertyAccess.propertyName, isNotNull);
3833 } 3831 }
3834 3832
3835 void test_parseAssignableExpression_expression_dot() { 3833 void test_parseAssignableExpression_expression_dot() {
3836 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y"); 3834 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y");
3837 JUnitTestCase.assertNotNull(propertyAccess.target); 3835 expect(propertyAccess.target, isNotNull);
3838 JUnitTestCase.assertNotNull(propertyAccess.operator); 3836 expect(propertyAccess.operator, isNotNull);
3839 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3837 expect(propertyAccess.propertyName, isNotNull);
3840 } 3838 }
3841 3839
3842 void test_parseAssignableExpression_expression_index() { 3840 void test_parseAssignableExpression_expression_index() {
3843 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]"); 3841 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]");
3844 JUnitTestCase.assertNotNull(expression.target); 3842 expect(expression.target, isNotNull);
3845 JUnitTestCase.assertNotNull(expression.leftBracket); 3843 expect(expression.leftBracket, isNotNull);
3846 JUnitTestCase.assertNotNull(expression.index); 3844 expect(expression.index, isNotNull);
3847 JUnitTestCase.assertNotNull(expression.rightBracket); 3845 expect(expression.rightBracket, isNotNull);
3848 } 3846 }
3849 3847
3850 void test_parseAssignableExpression_identifier() { 3848 void test_parseAssignableExpression_identifier() {
3851 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x"); 3849 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x");
3852 JUnitTestCase.assertNotNull(identifier); 3850 expect(identifier, isNotNull);
3853 } 3851 }
3854 3852
3855 void test_parseAssignableExpression_identifier_args_dot() { 3853 void test_parseAssignableExpression_identifier_args_dot() {
3856 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z"); 3854 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z");
3857 MethodInvocation invocation = propertyAccess.target as MethodInvocation; 3855 MethodInvocation invocation = propertyAccess.target as MethodInvocation;
3858 JUnitTestCase.assertEquals("x", invocation.methodName.name); 3856 expect(invocation.methodName.name, "x");
3859 ArgumentList argumentList = invocation.argumentList; 3857 ArgumentList argumentList = invocation.argumentList;
3860 JUnitTestCase.assertNotNull(argumentList); 3858 expect(argumentList, isNotNull);
3861 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 3859 EngineTestCase.assertSizeOfList(1, argumentList.arguments);
3862 JUnitTestCase.assertNotNull(propertyAccess.operator); 3860 expect(propertyAccess.operator, isNotNull);
3863 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3861 expect(propertyAccess.propertyName, isNotNull);
3864 } 3862 }
3865 3863
3866 void test_parseAssignableExpression_identifier_dot() { 3864 void test_parseAssignableExpression_identifier_dot() {
3867 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y"); 3865 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y");
3868 JUnitTestCase.assertNotNull(propertyAccess.target); 3866 expect(propertyAccess.target, isNotNull);
3869 JUnitTestCase.assertNotNull(propertyAccess.operator); 3867 expect(propertyAccess.operator, isNotNull);
3870 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3868 expect(propertyAccess.propertyName, isNotNull);
3871 } 3869 }
3872 3870
3873 void test_parseAssignableExpression_identifier_index() { 3871 void test_parseAssignableExpression_identifier_index() {
3874 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]"); 3872 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]");
3875 JUnitTestCase.assertNotNull(expression.target); 3873 expect(expression.target, isNotNull);
3876 JUnitTestCase.assertNotNull(expression.leftBracket); 3874 expect(expression.leftBracket, isNotNull);
3877 JUnitTestCase.assertNotNull(expression.index); 3875 expect(expression.index, isNotNull);
3878 JUnitTestCase.assertNotNull(expression.rightBracket); 3876 expect(expression.rightBracket, isNotNull);
3879 } 3877 }
3880 3878
3881 void test_parseAssignableExpression_super_dot() { 3879 void test_parseAssignableExpression_super_dot() {
3882 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y"); 3880 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y");
3883 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, propertyAccess.target); 3881 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, propertyAccess.target);
3884 JUnitTestCase.assertNotNull(propertyAccess.operator); 3882 expect(propertyAccess.operator, isNotNull);
3885 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3883 expect(propertyAccess.propertyName, isNotNull);
3886 } 3884 }
3887 3885
3888 void test_parseAssignableExpression_super_index() { 3886 void test_parseAssignableExpression_super_index() {
3889 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]"); 3887 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]");
3890 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.target); 3888 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.target);
3891 JUnitTestCase.assertNotNull(expression.leftBracket); 3889 expect(expression.leftBracket, isNotNull);
3892 JUnitTestCase.assertNotNull(expression.index); 3890 expect(expression.index, isNotNull);
3893 JUnitTestCase.assertNotNull(expression.rightBracket); 3891 expect(expression.rightBracket, isNotNull);
3894 } 3892 }
3895 3893
3896 void test_parseAssignableSelector_dot() { 3894 void test_parseAssignableSelector_dot() {
3897 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x"); 3895 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x");
3898 JUnitTestCase.assertNotNull(selector.operator); 3896 expect(selector.operator, isNotNull);
3899 JUnitTestCase.assertNotNull(selector.propertyName); 3897 expect(selector.propertyName, isNotNull);
3900 } 3898 }
3901 3899
3902 void test_parseAssignableSelector_index() { 3900 void test_parseAssignableSelector_index() {
3903 IndexExpression selector = ParserTestCase.parse("parseAssignableSelector", < Object> [null, true], "[x]"); 3901 IndexExpression selector = ParserTestCase.parse("parseAssignableSelector", < Object> [null, true], "[x]");
3904 JUnitTestCase.assertNotNull(selector.leftBracket); 3902 expect(selector.leftBracket, isNotNull);
3905 JUnitTestCase.assertNotNull(selector.index); 3903 expect(selector.index, isNotNull);
3906 JUnitTestCase.assertNotNull(selector.rightBracket); 3904 expect(selector.rightBracket, isNotNull);
3907 } 3905 }
3908 3906
3909 void test_parseAssignableSelector_none() { 3907 void test_parseAssignableSelector_none() {
3910 SimpleIdentifier selector = ParserTestCase.parse("parseAssignableSelector", <Object> [new SimpleIdentifier(null), true], ";"); 3908 SimpleIdentifier selector = ParserTestCase.parse("parseAssignableSelector", <Object> [new SimpleIdentifier(null), true], ";");
3911 JUnitTestCase.assertNotNull(selector); 3909 expect(selector, isNotNull);
3912 } 3910 }
3913 3911
3914 void test_parseAwaitExpression() { 3912 void test_parseAwaitExpression() {
3915 AwaitExpression expression = ParserTestCase.parse4("parseAwaitExpression", " await x;", []); 3913 AwaitExpression expression = ParserTestCase.parse4("parseAwaitExpression", " await x;", []);
3916 JUnitTestCase.assertNotNull(expression.awaitKeyword); 3914 expect(expression.awaitKeyword, isNotNull);
3917 JUnitTestCase.assertNotNull(expression.expression); 3915 expect(expression.expression, isNotNull);
3918 } 3916 }
3919 3917
3920 void test_parseAwaitExpression_asStatement_inAsync() { 3918 void test_parseAwaitExpression_asStatement_inAsync() {
3921 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() async { await x; }"); 3919 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() async { await x; }");
3922 FunctionBody body = method.body; 3920 FunctionBody body = method.body;
3923 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body); 3921 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body);
3924 Statement statement = (body as BlockFunctionBody).block.statements[0]; 3922 Statement statement = (body as BlockFunctionBody).block.statements[0];
3925 EngineTestCase.assertInstanceOf((obj) => obj is ExpressionStatement, Express ionStatement, statement); 3923 EngineTestCase.assertInstanceOf((obj) => obj is ExpressionStatement, Express ionStatement, statement);
3926 Expression expression = (statement as ExpressionStatement).expression; 3924 Expression expression = (statement as ExpressionStatement).expression;
3927 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, expression); 3925 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, expression);
3928 JUnitTestCase.assertNotNull((expression as AwaitExpression).awaitKeyword); 3926 expect((expression as AwaitExpression).awaitKeyword, isNotNull);
3929 JUnitTestCase.assertNotNull((expression as AwaitExpression).expression); 3927 expect((expression as AwaitExpression).expression, isNotNull);
3930 } 3928 }
3931 3929
3932 void test_parseAwaitExpression_asStatement_inSync() { 3930 void test_parseAwaitExpression_asStatement_inSync() {
3933 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { await x; }"); 3931 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { await x; }");
3934 FunctionBody body = method.body; 3932 FunctionBody body = method.body;
3935 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body); 3933 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body);
3936 Statement statement = (body as BlockFunctionBody).block.statements[0]; 3934 Statement statement = (body as BlockFunctionBody).block.statements[0];
3937 EngineTestCase.assertInstanceOf((obj) => obj is VariableDeclarationStatement , VariableDeclarationStatement, statement); 3935 EngineTestCase.assertInstanceOf((obj) => obj is VariableDeclarationStatement , VariableDeclarationStatement, statement);
3938 } 3936 }
3939 3937
3940 void test_parseAwaitExpression_inSync() { 3938 void test_parseAwaitExpression_inSync() {
3941 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { return await x + await y; }"); 3939 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { return await x + await y; }");
3942 FunctionBody body = method.body; 3940 FunctionBody body = method.body;
3943 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body); 3941 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, body);
3944 Statement statement = (body as BlockFunctionBody).block.statements[0]; 3942 Statement statement = (body as BlockFunctionBody).block.statements[0];
3945 EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnState ment, statement); 3943 EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnState ment, statement);
3946 Expression expression = (statement as ReturnStatement).expression; 3944 Expression expression = (statement as ReturnStatement).expression;
3947 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression); 3945 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpr ession, expression);
3948 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, (expression as BinaryExpression).leftOperand); 3946 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, (expression as BinaryExpression).leftOperand);
3949 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, (expression as BinaryExpression).rightOperand); 3947 EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpres sion, (expression as BinaryExpression).rightOperand);
3950 } 3948 }
3951 3949
3952 void test_parseBitwiseAndExpression_normal() { 3950 void test_parseBitwiseAndExpression_normal() {
3953 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpressi on", "x & y", []); 3951 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpressi on", "x & y", []);
3954 JUnitTestCase.assertNotNull(expression.leftOperand); 3952 expect(expression.leftOperand, isNotNull);
3955 JUnitTestCase.assertNotNull(expression.operator); 3953 expect(expression.operator, isNotNull);
3956 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type); 3954 expect(expression.operator.type, TokenType.AMPERSAND);
3957 JUnitTestCase.assertNotNull(expression.rightOperand); 3955 expect(expression.rightOperand, isNotNull);
3958 } 3956 }
3959 3957
3960 void test_parseBitwiseAndExpression_super() { 3958 void test_parseBitwiseAndExpression_super() {
3961 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpressi on", "super & y", []); 3959 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpressi on", "super & y", []);
3962 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 3960 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
3963 JUnitTestCase.assertNotNull(expression.operator); 3961 expect(expression.operator, isNotNull);
3964 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type); 3962 expect(expression.operator.type, TokenType.AMPERSAND);
3965 JUnitTestCase.assertNotNull(expression.rightOperand); 3963 expect(expression.rightOperand, isNotNull);
3966 } 3964 }
3967 3965
3968 void test_parseBitwiseOrExpression_normal() { 3966 void test_parseBitwiseOrExpression_normal() {
3969 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpressio n", "x | y", []); 3967 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpressio n", "x | y", []);
3970 JUnitTestCase.assertNotNull(expression.leftOperand); 3968 expect(expression.leftOperand, isNotNull);
3971 JUnitTestCase.assertNotNull(expression.operator); 3969 expect(expression.operator, isNotNull);
3972 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type); 3970 expect(expression.operator.type, TokenType.BAR);
3973 JUnitTestCase.assertNotNull(expression.rightOperand); 3971 expect(expression.rightOperand, isNotNull);
3974 } 3972 }
3975 3973
3976 void test_parseBitwiseOrExpression_super() { 3974 void test_parseBitwiseOrExpression_super() {
3977 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpressio n", "super | y", []); 3975 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpressio n", "super | y", []);
3978 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 3976 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
3979 JUnitTestCase.assertNotNull(expression.operator); 3977 expect(expression.operator, isNotNull);
3980 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type); 3978 expect(expression.operator.type, TokenType.BAR);
3981 JUnitTestCase.assertNotNull(expression.rightOperand); 3979 expect(expression.rightOperand, isNotNull);
3982 } 3980 }
3983 3981
3984 void test_parseBitwiseXorExpression_normal() { 3982 void test_parseBitwiseXorExpression_normal() {
3985 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "x ^ y", []); 3983 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "x ^ y", []);
3986 JUnitTestCase.assertNotNull(expression.leftOperand); 3984 expect(expression.leftOperand, isNotNull);
3987 JUnitTestCase.assertNotNull(expression.operator); 3985 expect(expression.operator, isNotNull);
3988 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type); 3986 expect(expression.operator.type, TokenType.CARET);
3989 JUnitTestCase.assertNotNull(expression.rightOperand); 3987 expect(expression.rightOperand, isNotNull);
3990 } 3988 }
3991 3989
3992 void test_parseBitwiseXorExpression_super() { 3990 void test_parseBitwiseXorExpression_super() {
3993 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "super ^ y", []); 3991 BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpressi on", "super ^ y", []);
3994 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 3992 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
3995 JUnitTestCase.assertNotNull(expression.operator); 3993 expect(expression.operator, isNotNull);
3996 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type); 3994 expect(expression.operator.type, TokenType.CARET);
3997 JUnitTestCase.assertNotNull(expression.rightOperand); 3995 expect(expression.rightOperand, isNotNull);
3998 } 3996 }
3999 3997
4000 void test_parseBlock_empty() { 3998 void test_parseBlock_empty() {
4001 Block block = ParserTestCase.parse4("parseBlock", "{}", []); 3999 Block block = ParserTestCase.parse4("parseBlock", "{}", []);
4002 JUnitTestCase.assertNotNull(block.leftBracket); 4000 expect(block.leftBracket, isNotNull);
4003 EngineTestCase.assertSizeOfList(0, block.statements); 4001 EngineTestCase.assertSizeOfList(0, block.statements);
4004 JUnitTestCase.assertNotNull(block.rightBracket); 4002 expect(block.rightBracket, isNotNull);
4005 } 4003 }
4006 4004
4007 void test_parseBlock_nonEmpty() { 4005 void test_parseBlock_nonEmpty() {
4008 Block block = ParserTestCase.parse4("parseBlock", "{;}", []); 4006 Block block = ParserTestCase.parse4("parseBlock", "{;}", []);
4009 JUnitTestCase.assertNotNull(block.leftBracket); 4007 expect(block.leftBracket, isNotNull);
4010 EngineTestCase.assertSizeOfList(1, block.statements); 4008 EngineTestCase.assertSizeOfList(1, block.statements);
4011 JUnitTestCase.assertNotNull(block.rightBracket); 4009 expect(block.rightBracket, isNotNull);
4012 } 4010 }
4013 4011
4014 void test_parseBreakStatement_label() { 4012 void test_parseBreakStatement_label() {
4015 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak foo;", []); 4013 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak foo;", []);
4016 JUnitTestCase.assertNotNull(statement.keyword); 4014 expect(statement.keyword, isNotNull);
4017 JUnitTestCase.assertNotNull(statement.label); 4015 expect(statement.label, isNotNull);
4018 JUnitTestCase.assertNotNull(statement.semicolon); 4016 expect(statement.semicolon, isNotNull);
4019 } 4017 }
4020 4018
4021 void test_parseBreakStatement_noLabel() { 4019 void test_parseBreakStatement_noLabel() {
4022 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); 4020 BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
4023 JUnitTestCase.assertNotNull(statement.keyword); 4021 expect(statement.keyword, isNotNull);
4024 JUnitTestCase.assertNull(statement.label); 4022 expect(statement.label, isNull);
4025 JUnitTestCase.assertNotNull(statement.semicolon); 4023 expect(statement.semicolon, isNotNull);
4026 } 4024 }
4027 4025
4028 void test_parseCascadeSection_i() { 4026 void test_parseCascadeSection_i() {
4029 IndexExpression section = ParserTestCase.parse4("parseCascadeSection", "..[i ]", []); 4027 IndexExpression section = ParserTestCase.parse4("parseCascadeSection", "..[i ]", []);
4030 JUnitTestCase.assertNull(section.target); 4028 expect(section.target, isNull);
4031 JUnitTestCase.assertNotNull(section.leftBracket); 4029 expect(section.leftBracket, isNotNull);
4032 JUnitTestCase.assertNotNull(section.index); 4030 expect(section.index, isNotNull);
4033 JUnitTestCase.assertNotNull(section.rightBracket); 4031 expect(section.rightBracket, isNotNull);
4034 } 4032 }
4035 4033
4036 void test_parseCascadeSection_ia() { 4034 void test_parseCascadeSection_ia() {
4037 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..[i](b)", []); 4035 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..[i](b)", []);
4038 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpres sion, section.function); 4036 EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpres sion, section.function);
4039 JUnitTestCase.assertNotNull(section.argumentList); 4037 expect(section.argumentList, isNotNull);
4040 } 4038 }
4041 4039
4042 void test_parseCascadeSection_ii() { 4040 void test_parseCascadeSection_ii() {
4043 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b).c(d)", []); 4041 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b).c(d)", []);
4044 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.target); 4042 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.target);
4045 JUnitTestCase.assertNotNull(section.period); 4043 expect(section.period, isNotNull);
4046 JUnitTestCase.assertNotNull(section.methodName); 4044 expect(section.methodName, isNotNull);
4047 JUnitTestCase.assertNotNull(section.argumentList); 4045 expect(section.argumentList, isNotNull);
4048 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4046 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments);
4049 } 4047 }
4050 4048
4051 void test_parseCascadeSection_p() { 4049 void test_parseCascadeSection_p() {
4052 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a", []); 4050 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a", []);
4053 JUnitTestCase.assertNull(section.target); 4051 expect(section.target, isNull);
4054 JUnitTestCase.assertNotNull(section.operator); 4052 expect(section.operator, isNotNull);
4055 JUnitTestCase.assertNotNull(section.propertyName); 4053 expect(section.propertyName, isNotNull);
4056 } 4054 }
4057 4055
4058 void test_parseCascadeSection_p_assign() { 4056 void test_parseCascadeSection_p_assign() {
4059 AssignmentExpression section = ParserTestCase.parse4("parseCascadeSection", "..a = 3", []); 4057 AssignmentExpression section = ParserTestCase.parse4("parseCascadeSection", "..a = 3", []);
4060 JUnitTestCase.assertNotNull(section.leftHandSide); 4058 expect(section.leftHandSide, isNotNull);
4061 JUnitTestCase.assertNotNull(section.operator); 4059 expect(section.operator, isNotNull);
4062 Expression rhs = section.rightHandSide; 4060 Expression rhs = section.rightHandSide;
4063 JUnitTestCase.assertNotNull(rhs); 4061 expect(rhs, isNotNull);
4064 } 4062 }
4065 4063
4066 void test_parseCascadeSection_p_assign_withCascade() { 4064 void test_parseCascadeSection_p_assign_withCascade() {
4067 AssignmentExpression section = ParserTestCase.parse4("parseCascadeSection", "..a = 3..m()", []); 4065 AssignmentExpression section = ParserTestCase.parse4("parseCascadeSection", "..a = 3..m()", []);
4068 JUnitTestCase.assertNotNull(section.leftHandSide); 4066 expect(section.leftHandSide, isNotNull);
4069 JUnitTestCase.assertNotNull(section.operator); 4067 expect(section.operator, isNotNull);
4070 Expression rhs = section.rightHandSide; 4068 Expression rhs = section.rightHandSide;
4071 EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiter al, rhs); 4069 EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiter al, rhs);
4072 } 4070 }
4073 4071
4074 void test_parseCascadeSection_p_builtIn() { 4072 void test_parseCascadeSection_p_builtIn() {
4075 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..as" , []); 4073 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..as" , []);
4076 JUnitTestCase.assertNull(section.target); 4074 expect(section.target, isNull);
4077 JUnitTestCase.assertNotNull(section.operator); 4075 expect(section.operator, isNotNull);
4078 JUnitTestCase.assertNotNull(section.propertyName); 4076 expect(section.propertyName, isNotNull);
4079 } 4077 }
4080 4078
4081 void test_parseCascadeSection_pa() { 4079 void test_parseCascadeSection_pa() {
4082 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b)", []); 4080 MethodInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a (b)", []);
4083 JUnitTestCase.assertNull(section.target); 4081 expect(section.target, isNull);
4084 JUnitTestCase.assertNotNull(section.period); 4082 expect(section.period, isNotNull);
4085 JUnitTestCase.assertNotNull(section.methodName); 4083 expect(section.methodName, isNotNull);
4086 JUnitTestCase.assertNotNull(section.argumentList); 4084 expect(section.argumentList, isNotNull);
4087 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4085 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments);
4088 } 4086 }
4089 4087
4090 void test_parseCascadeSection_paa() { 4088 void test_parseCascadeSection_paa() {
4091 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c)", []); 4089 FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSe ction", "..a(b)(c)", []);
4092 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function); 4090 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function);
4093 JUnitTestCase.assertNotNull(section.argumentList); 4091 expect(section.argumentList, isNotNull);
4094 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4092 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments);
4095 } 4093 }
4096 4094
4097 void test_parseCascadeSection_paapaa() { 4095 void test_parseCascadeSection_paapaa() {
4098 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)", []);
4099 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function); 4097 EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvo cation, section.function);
4100 JUnitTestCase.assertNotNull(section.argumentList); 4098 expect(section.argumentList, isNotNull);
4101 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments); 4099 EngineTestCase.assertSizeOfList(1, section.argumentList.arguments);
4102 } 4100 }
4103 4101
4104 void test_parseCascadeSection_pap() { 4102 void test_parseCascadeSection_pap() {
4105 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a(b ).c", []); 4103 PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a(b ).c", []);
4106 JUnitTestCase.assertNotNull(section.target); 4104 expect(section.target, isNotNull);
4107 JUnitTestCase.assertNotNull(section.operator); 4105 expect(section.operator, isNotNull);
4108 JUnitTestCase.assertNotNull(section.propertyName); 4106 expect(section.propertyName, isNotNull);
4109 } 4107 }
4110 4108
4111 void test_parseClassDeclaration_abstract() { 4109 void test_parseClassDeclaration_abstract() {
4112 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [ 4110 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [
4113 emptyCommentAndMetadata(), 4111 emptyCommentAndMetadata(),
4114 TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)], "class A {}"); 4112 TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)], "class A {}");
4115 JUnitTestCase.assertNull(declaration.documentationComment); 4113 expect(declaration.documentationComment, isNull);
4116 JUnitTestCase.assertNotNull(declaration.abstractKeyword); 4114 expect(declaration.abstractKeyword, isNotNull);
4117 JUnitTestCase.assertNull(declaration.extendsClause); 4115 expect(declaration.extendsClause, isNull);
4118 JUnitTestCase.assertNull(declaration.implementsClause); 4116 expect(declaration.implementsClause, isNull);
4119 JUnitTestCase.assertNotNull(declaration.classKeyword); 4117 expect(declaration.classKeyword, isNotNull);
4120 JUnitTestCase.assertNotNull(declaration.leftBracket); 4118 expect(declaration.leftBracket, isNotNull);
4121 JUnitTestCase.assertNotNull(declaration.name); 4119 expect(declaration.name, isNotNull);
4122 EngineTestCase.assertSizeOfList(0, declaration.members); 4120 EngineTestCase.assertSizeOfList(0, declaration.members);
4123 JUnitTestCase.assertNotNull(declaration.rightBracket); 4121 expect(declaration.rightBracket, isNotNull);
4124 JUnitTestCase.assertNull(declaration.typeParameters); 4122 expect(declaration.typeParameters, isNull);
4125 } 4123 }
4126 4124
4127 void test_parseClassDeclaration_empty() { 4125 void test_parseClassDeclaration_empty() {
4128 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}"); 4126 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}");
4129 JUnitTestCase.assertNull(declaration.documentationComment); 4127 expect(declaration.documentationComment, isNull);
4130 JUnitTestCase.assertNull(declaration.abstractKeyword); 4128 expect(declaration.abstractKeyword, isNull);
4131 JUnitTestCase.assertNull(declaration.extendsClause); 4129 expect(declaration.extendsClause, isNull);
4132 JUnitTestCase.assertNull(declaration.implementsClause); 4130 expect(declaration.implementsClause, isNull);
4133 JUnitTestCase.assertNotNull(declaration.classKeyword); 4131 expect(declaration.classKeyword, isNotNull);
4134 JUnitTestCase.assertNotNull(declaration.leftBracket); 4132 expect(declaration.leftBracket, isNotNull);
4135 JUnitTestCase.assertNotNull(declaration.name); 4133 expect(declaration.name, isNotNull);
4136 EngineTestCase.assertSizeOfList(0, declaration.members); 4134 EngineTestCase.assertSizeOfList(0, declaration.members);
4137 JUnitTestCase.assertNotNull(declaration.rightBracket); 4135 expect(declaration.rightBracket, isNotNull);
4138 JUnitTestCase.assertNull(declaration.typeParameters); 4136 expect(declaration.typeParameters, isNull);
4139 } 4137 }
4140 4138
4141 void test_parseClassDeclaration_extends() { 4139 void test_parseClassDeclaration_extends() {
4142 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 {}");
4143 JUnitTestCase.assertNull(declaration.documentationComment); 4141 expect(declaration.documentationComment, isNull);
4144 JUnitTestCase.assertNull(declaration.abstractKeyword); 4142 expect(declaration.abstractKeyword, isNull);
4145 JUnitTestCase.assertNotNull(declaration.extendsClause); 4143 expect(declaration.extendsClause, isNotNull);
4146 JUnitTestCase.assertNull(declaration.implementsClause); 4144 expect(declaration.implementsClause, isNull);
4147 JUnitTestCase.assertNotNull(declaration.classKeyword); 4145 expect(declaration.classKeyword, isNotNull);
4148 JUnitTestCase.assertNotNull(declaration.leftBracket); 4146 expect(declaration.leftBracket, isNotNull);
4149 JUnitTestCase.assertNotNull(declaration.name); 4147 expect(declaration.name, isNotNull);
4150 EngineTestCase.assertSizeOfList(0, declaration.members); 4148 EngineTestCase.assertSizeOfList(0, declaration.members);
4151 JUnitTestCase.assertNotNull(declaration.rightBracket); 4149 expect(declaration.rightBracket, isNotNull);
4152 JUnitTestCase.assertNull(declaration.typeParameters); 4150 expect(declaration.typeParameters, isNull);
4153 } 4151 }
4154 4152
4155 void test_parseClassDeclaration_extendsAndImplements() { 4153 void test_parseClassDeclaration_extendsAndImplements() {
4156 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 {}" );
4157 JUnitTestCase.assertNull(declaration.documentationComment); 4155 expect(declaration.documentationComment, isNull);
4158 JUnitTestCase.assertNull(declaration.abstractKeyword); 4156 expect(declaration.abstractKeyword, isNull);
4159 JUnitTestCase.assertNotNull(declaration.extendsClause); 4157 expect(declaration.extendsClause, isNotNull);
4160 JUnitTestCase.assertNotNull(declaration.implementsClause); 4158 expect(declaration.implementsClause, isNotNull);
4161 JUnitTestCase.assertNotNull(declaration.classKeyword); 4159 expect(declaration.classKeyword, isNotNull);
4162 JUnitTestCase.assertNotNull(declaration.leftBracket); 4160 expect(declaration.leftBracket, isNotNull);
4163 JUnitTestCase.assertNotNull(declaration.name); 4161 expect(declaration.name, isNotNull);
4164 EngineTestCase.assertSizeOfList(0, declaration.members); 4162 EngineTestCase.assertSizeOfList(0, declaration.members);
4165 JUnitTestCase.assertNotNull(declaration.rightBracket); 4163 expect(declaration.rightBracket, isNotNull);
4166 JUnitTestCase.assertNull(declaration.typeParameters); 4164 expect(declaration.typeParameters, isNull);
4167 } 4165 }
4168 4166
4169 void test_parseClassDeclaration_extendsAndWith() { 4167 void test_parseClassDeclaration_extendsAndWith() {
4170 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 {}");
4171 JUnitTestCase.assertNull(declaration.documentationComment); 4169 expect(declaration.documentationComment, isNull);
4172 JUnitTestCase.assertNull(declaration.abstractKeyword); 4170 expect(declaration.abstractKeyword, isNull);
4173 JUnitTestCase.assertNotNull(declaration.classKeyword); 4171 expect(declaration.classKeyword, isNotNull);
4174 JUnitTestCase.assertNotNull(declaration.name); 4172 expect(declaration.name, isNotNull);
4175 JUnitTestCase.assertNull(declaration.typeParameters); 4173 expect(declaration.typeParameters, isNull);
4176 JUnitTestCase.assertNotNull(declaration.extendsClause); 4174 expect(declaration.extendsClause, isNotNull);
4177 JUnitTestCase.assertNotNull(declaration.withClause); 4175 expect(declaration.withClause, isNotNull);
4178 JUnitTestCase.assertNull(declaration.implementsClause); 4176 expect(declaration.implementsClause, isNull);
4179 JUnitTestCase.assertNotNull(declaration.leftBracket); 4177 expect(declaration.leftBracket, isNotNull);
4180 EngineTestCase.assertSizeOfList(0, declaration.members); 4178 EngineTestCase.assertSizeOfList(0, declaration.members);
4181 JUnitTestCase.assertNotNull(declaration.rightBracket); 4179 expect(declaration.rightBracket, isNotNull);
4182 } 4180 }
4183 4181
4184 void test_parseClassDeclaration_extendsAndWithAndImplements() { 4182 void test_parseClassDeclaration_extendsAndWithAndImplements() {
4185 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 {}");
4186 JUnitTestCase.assertNull(declaration.documentationComment); 4184 expect(declaration.documentationComment, isNull);
4187 JUnitTestCase.assertNull(declaration.abstractKeyword); 4185 expect(declaration.abstractKeyword, isNull);
4188 JUnitTestCase.assertNotNull(declaration.classKeyword); 4186 expect(declaration.classKeyword, isNotNull);
4189 JUnitTestCase.assertNotNull(declaration.name); 4187 expect(declaration.name, isNotNull);
4190 JUnitTestCase.assertNull(declaration.typeParameters); 4188 expect(declaration.typeParameters, isNull);
4191 JUnitTestCase.assertNotNull(declaration.extendsClause); 4189 expect(declaration.extendsClause, isNotNull);
4192 JUnitTestCase.assertNotNull(declaration.withClause); 4190 expect(declaration.withClause, isNotNull);
4193 JUnitTestCase.assertNotNull(declaration.implementsClause); 4191 expect(declaration.implementsClause, isNotNull);
4194 JUnitTestCase.assertNotNull(declaration.leftBracket); 4192 expect(declaration.leftBracket, isNotNull);
4195 EngineTestCase.assertSizeOfList(0, declaration.members); 4193 EngineTestCase.assertSizeOfList(0, declaration.members);
4196 JUnitTestCase.assertNotNull(declaration.rightBracket); 4194 expect(declaration.rightBracket, isNotNull);
4197 } 4195 }
4198 4196
4199 void test_parseClassDeclaration_implements() { 4197 void test_parseClassDeclaration_implements() {
4200 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 {}");
4201 JUnitTestCase.assertNull(declaration.documentationComment); 4199 expect(declaration.documentationComment, isNull);
4202 JUnitTestCase.assertNull(declaration.abstractKeyword); 4200 expect(declaration.abstractKeyword, isNull);
4203 JUnitTestCase.assertNull(declaration.extendsClause); 4201 expect(declaration.extendsClause, isNull);
4204 JUnitTestCase.assertNotNull(declaration.implementsClause); 4202 expect(declaration.implementsClause, isNotNull);
4205 JUnitTestCase.assertNotNull(declaration.classKeyword); 4203 expect(declaration.classKeyword, isNotNull);
4206 JUnitTestCase.assertNotNull(declaration.leftBracket); 4204 expect(declaration.leftBracket, isNotNull);
4207 JUnitTestCase.assertNotNull(declaration.name); 4205 expect(declaration.name, isNotNull);
4208 EngineTestCase.assertSizeOfList(0, declaration.members); 4206 EngineTestCase.assertSizeOfList(0, declaration.members);
4209 JUnitTestCase.assertNotNull(declaration.rightBracket); 4207 expect(declaration.rightBracket, isNotNull);
4210 JUnitTestCase.assertNull(declaration.typeParameters); 4208 expect(declaration.typeParameters, isNull);
4211 } 4209 }
4212 4210
4213 void test_parseClassDeclaration_native() { 4211 void test_parseClassDeclaration_native() {
4214 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' {}");
4215 NativeClause nativeClause = declaration.nativeClause; 4213 NativeClause nativeClause = declaration.nativeClause;
4216 JUnitTestCase.assertNotNull(nativeClause); 4214 expect(nativeClause, isNotNull);
4217 JUnitTestCase.assertNotNull(nativeClause.keyword); 4215 expect(nativeClause.keyword, isNotNull);
4218 JUnitTestCase.assertEquals("nativeValue", nativeClause.name.stringValue); 4216 expect(nativeClause.name.stringValue, "nativeValue");
4219 JUnitTestCase.assertSame(nativeClause.keyword, nativeClause.beginToken); 4217 expect(nativeClause.beginToken, same(nativeClause.keyword));
4220 JUnitTestCase.assertSame(nativeClause.name.endToken, nativeClause.endToken); 4218 expect(nativeClause.endToken, same(nativeClause.name.endToken));
4221 } 4219 }
4222 4220
4223 void test_parseClassDeclaration_nonEmpty() { 4221 void test_parseClassDeclaration_nonEmpty() {
4224 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;}");
4225 JUnitTestCase.assertNull(declaration.documentationComment); 4223 expect(declaration.documentationComment, isNull);
4226 JUnitTestCase.assertNull(declaration.abstractKeyword); 4224 expect(declaration.abstractKeyword, isNull);
4227 JUnitTestCase.assertNull(declaration.extendsClause); 4225 expect(declaration.extendsClause, isNull);
4228 JUnitTestCase.assertNull(declaration.implementsClause); 4226 expect(declaration.implementsClause, isNull);
4229 JUnitTestCase.assertNotNull(declaration.classKeyword); 4227 expect(declaration.classKeyword, isNotNull);
4230 JUnitTestCase.assertNotNull(declaration.leftBracket); 4228 expect(declaration.leftBracket, isNotNull);
4231 JUnitTestCase.assertNotNull(declaration.name); 4229 expect(declaration.name, isNotNull);
4232 EngineTestCase.assertSizeOfList(1, declaration.members); 4230 EngineTestCase.assertSizeOfList(1, declaration.members);
4233 JUnitTestCase.assertNotNull(declaration.rightBracket); 4231 expect(declaration.rightBracket, isNotNull);
4234 JUnitTestCase.assertNull(declaration.typeParameters); 4232 expect(declaration.typeParameters, isNull);
4235 } 4233 }
4236 4234
4237 void test_parseClassDeclaration_typeAlias_implementsC() { 4235 void test_parseClassDeclaration_typeAlias_implementsC() {
4238 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;" );
4239 JUnitTestCase.assertNotNull(typeAlias.keyword); 4237 expect(typeAlias.keyword, isNotNull);
4240 JUnitTestCase.assertNotNull(typeAlias.name); 4238 expect(typeAlias.name, isNotNull);
4241 JUnitTestCase.assertNull(typeAlias.typeParameters); 4239 expect(typeAlias.typeParameters, isNull);
4242 JUnitTestCase.assertNotNull(typeAlias.withClause); 4240 expect(typeAlias.withClause, isNotNull);
4243 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 4241 expect(typeAlias.implementsClause, isNotNull);
4244 JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword); 4242 expect(typeAlias.implementsClause.keyword, isNotNull);
4245 JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length); 4243 expect(typeAlias.implementsClause.interfaces.length, 1);
4246 JUnitTestCase.assertNotNull(typeAlias.semicolon); 4244 expect(typeAlias.semicolon, isNotNull);
4247 } 4245 }
4248 4246
4249 void test_parseClassDeclaration_typeAlias_withB() { 4247 void test_parseClassDeclaration_typeAlias_withB() {
4250 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B;"); 4248 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B;");
4251 JUnitTestCase.assertNotNull(typeAlias.keyword); 4249 expect(typeAlias.keyword, isNotNull);
4252 JUnitTestCase.assertNotNull(typeAlias.name); 4250 expect(typeAlias.name, isNotNull);
4253 JUnitTestCase.assertNull(typeAlias.typeParameters); 4251 expect(typeAlias.typeParameters, isNull);
4254 JUnitTestCase.assertNotNull(typeAlias.withClause); 4252 expect(typeAlias.withClause, isNotNull);
4255 JUnitTestCase.assertNotNull(typeAlias.withClause.withKeyword); 4253 expect(typeAlias.withClause.withKeyword, isNotNull);
4256 JUnitTestCase.assertEquals(1, typeAlias.withClause.mixinTypes.length); 4254 expect(typeAlias.withClause.mixinTypes.length, 1);
4257 JUnitTestCase.assertNull(typeAlias.implementsClause); 4255 expect(typeAlias.implementsClause, isNull);
4258 JUnitTestCase.assertNotNull(typeAlias.semicolon); 4256 expect(typeAlias.semicolon, isNotNull);
4259 } 4257 }
4260 4258
4261 void test_parseClassDeclaration_typeParameters() { 4259 void test_parseClassDeclaration_typeParameters() {
4262 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}"); 4260 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}");
4263 JUnitTestCase.assertNull(declaration.documentationComment); 4261 expect(declaration.documentationComment, isNull);
4264 JUnitTestCase.assertNull(declaration.abstractKeyword); 4262 expect(declaration.abstractKeyword, isNull);
4265 JUnitTestCase.assertNull(declaration.extendsClause); 4263 expect(declaration.extendsClause, isNull);
4266 JUnitTestCase.assertNull(declaration.implementsClause); 4264 expect(declaration.implementsClause, isNull);
4267 JUnitTestCase.assertNotNull(declaration.classKeyword); 4265 expect(declaration.classKeyword, isNotNull);
4268 JUnitTestCase.assertNotNull(declaration.leftBracket); 4266 expect(declaration.leftBracket, isNotNull);
4269 JUnitTestCase.assertNotNull(declaration.name); 4267 expect(declaration.name, isNotNull);
4270 EngineTestCase.assertSizeOfList(0, declaration.members); 4268 EngineTestCase.assertSizeOfList(0, declaration.members);
4271 JUnitTestCase.assertNotNull(declaration.rightBracket); 4269 expect(declaration.rightBracket, isNotNull);
4272 JUnitTestCase.assertNotNull(declaration.typeParameters); 4270 expect(declaration.typeParameters, isNotNull);
4273 EngineTestCase.assertSizeOfList(1, declaration.typeParameters.typeParameters ); 4271 EngineTestCase.assertSizeOfList(1, declaration.typeParameters.typeParameters );
4274 } 4272 }
4275 4273
4276 void test_parseClassMember_constructor_withInitializers() { 4274 void test_parseClassMember_constructor_withInitializers() {
4277 // 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.
4278 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}"); 4276 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}");
4279 JUnitTestCase.assertNotNull(constructor.body); 4277 expect(constructor.body, isNotNull);
4280 JUnitTestCase.assertNotNull(constructor.separator); 4278 expect(constructor.separator, isNotNull);
4281 JUnitTestCase.assertNull(constructor.externalKeyword); 4279 expect(constructor.externalKeyword, isNull);
4282 JUnitTestCase.assertNull(constructor.constKeyword); 4280 expect(constructor.constKeyword, isNull);
4283 JUnitTestCase.assertNull(constructor.factoryKeyword); 4281 expect(constructor.factoryKeyword, isNull);
4284 JUnitTestCase.assertNull(constructor.name); 4282 expect(constructor.name, isNull);
4285 JUnitTestCase.assertNotNull(constructor.parameters); 4283 expect(constructor.parameters, isNotNull);
4286 JUnitTestCase.assertNull(constructor.period); 4284 expect(constructor.period, isNull);
4287 JUnitTestCase.assertNotNull(constructor.returnType); 4285 expect(constructor.returnType, isNotNull);
4288 EngineTestCase.assertSizeOfList(1, constructor.initializers); 4286 EngineTestCase.assertSizeOfList(1, constructor.initializers);
4289 } 4287 }
4290 4288
4291 void test_parseClassMember_field_instance_prefixedType() { 4289 void test_parseClassMember_field_instance_prefixedType() {
4292 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;"); 4290 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;");
4293 JUnitTestCase.assertNull(field.documentationComment); 4291 expect(field.documentationComment, isNull);
4294 EngineTestCase.assertSizeOfList(0, field.metadata); 4292 EngineTestCase.assertSizeOfList(0, field.metadata);
4295 JUnitTestCase.assertNull(field.staticKeyword); 4293 expect(field.staticKeyword, isNull);
4296 VariableDeclarationList list = field.fields; 4294 VariableDeclarationList list = field.fields;
4297 JUnitTestCase.assertNotNull(list); 4295 expect(list, isNotNull);
4298 NodeList<VariableDeclaration> variables = list.variables; 4296 NodeList<VariableDeclaration> variables = list.variables;
4299 EngineTestCase.assertSizeOfList(1, variables); 4297 EngineTestCase.assertSizeOfList(1, variables);
4300 VariableDeclaration variable = variables[0]; 4298 VariableDeclaration variable = variables[0];
4301 JUnitTestCase.assertNotNull(variable.name); 4299 expect(variable.name, isNotNull);
4302 } 4300 }
4303 4301
4304 void test_parseClassMember_field_namedGet() { 4302 void test_parseClassMember_field_namedGet() {
4305 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;"); 4303 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;");
4306 JUnitTestCase.assertNull(field.documentationComment); 4304 expect(field.documentationComment, isNull);
4307 EngineTestCase.assertSizeOfList(0, field.metadata); 4305 EngineTestCase.assertSizeOfList(0, field.metadata);
4308 JUnitTestCase.assertNull(field.staticKeyword); 4306 expect(field.staticKeyword, isNull);
4309 VariableDeclarationList list = field.fields; 4307 VariableDeclarationList list = field.fields;
4310 JUnitTestCase.assertNotNull(list); 4308 expect(list, isNotNull);
4311 NodeList<VariableDeclaration> variables = list.variables; 4309 NodeList<VariableDeclaration> variables = list.variables;
4312 EngineTestCase.assertSizeOfList(1, variables); 4310 EngineTestCase.assertSizeOfList(1, variables);
4313 VariableDeclaration variable = variables[0]; 4311 VariableDeclaration variable = variables[0];
4314 JUnitTestCase.assertNotNull(variable.name); 4312 expect(variable.name, isNotNull);
4315 } 4313 }
4316 4314
4317 void test_parseClassMember_field_namedOperator() { 4315 void test_parseClassMember_field_namedOperator() {
4318 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;"); 4316 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;");
4319 JUnitTestCase.assertNull(field.documentationComment); 4317 expect(field.documentationComment, isNull);
4320 EngineTestCase.assertSizeOfList(0, field.metadata); 4318 EngineTestCase.assertSizeOfList(0, field.metadata);
4321 JUnitTestCase.assertNull(field.staticKeyword); 4319 expect(field.staticKeyword, isNull);
4322 VariableDeclarationList list = field.fields; 4320 VariableDeclarationList list = field.fields;
4323 JUnitTestCase.assertNotNull(list); 4321 expect(list, isNotNull);
4324 NodeList<VariableDeclaration> variables = list.variables; 4322 NodeList<VariableDeclaration> variables = list.variables;
4325 EngineTestCase.assertSizeOfList(1, variables); 4323 EngineTestCase.assertSizeOfList(1, variables);
4326 VariableDeclaration variable = variables[0]; 4324 VariableDeclaration variable = variables[0];
4327 JUnitTestCase.assertNotNull(variable.name); 4325 expect(variable.name, isNotNull);
4328 } 4326 }
4329 4327
4330 void test_parseClassMember_field_namedOperator_withAssignment() { 4328 void test_parseClassMember_field_namedOperator_withAssignment() {
4331 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator = (5);"); 4329 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator = (5);");
4332 JUnitTestCase.assertNull(field.documentationComment); 4330 expect(field.documentationComment, isNull);
4333 EngineTestCase.assertSizeOfList(0, field.metadata); 4331 EngineTestCase.assertSizeOfList(0, field.metadata);
4334 JUnitTestCase.assertNull(field.staticKeyword); 4332 expect(field.staticKeyword, isNull);
4335 VariableDeclarationList list = field.fields; 4333 VariableDeclarationList list = field.fields;
4336 JUnitTestCase.assertNotNull(list); 4334 expect(list, isNotNull);
4337 NodeList<VariableDeclaration> variables = list.variables; 4335 NodeList<VariableDeclaration> variables = list.variables;
4338 EngineTestCase.assertSizeOfList(1, variables); 4336 EngineTestCase.assertSizeOfList(1, variables);
4339 VariableDeclaration variable = variables[0]; 4337 VariableDeclaration variable = variables[0];
4340 JUnitTestCase.assertNotNull(variable.name); 4338 expect(variable.name, isNotNull);
4341 JUnitTestCase.assertNotNull(variable.initializer); 4339 expect(variable.initializer, isNotNull);
4342 } 4340 }
4343 4341
4344 void test_parseClassMember_field_namedSet() { 4342 void test_parseClassMember_field_namedSet() {
4345 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;"); 4343 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;");
4346 JUnitTestCase.assertNull(field.documentationComment); 4344 expect(field.documentationComment, isNull);
4347 EngineTestCase.assertSizeOfList(0, field.metadata); 4345 EngineTestCase.assertSizeOfList(0, field.metadata);
4348 JUnitTestCase.assertNull(field.staticKeyword); 4346 expect(field.staticKeyword, isNull);
4349 VariableDeclarationList list = field.fields; 4347 VariableDeclarationList list = field.fields;
4350 JUnitTestCase.assertNotNull(list); 4348 expect(list, isNotNull);
4351 NodeList<VariableDeclaration> variables = list.variables; 4349 NodeList<VariableDeclaration> variables = list.variables;
4352 EngineTestCase.assertSizeOfList(1, variables); 4350 EngineTestCase.assertSizeOfList(1, variables);
4353 VariableDeclaration variable = variables[0]; 4351 VariableDeclaration variable = variables[0];
4354 JUnitTestCase.assertNotNull(variable.name); 4352 expect(variable.name, isNotNull);
4355 } 4353 }
4356 4354
4357 void test_parseClassMember_getter_void() { 4355 void test_parseClassMember_getter_void() {
4358 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}"); 4356 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}");
4359 JUnitTestCase.assertNull(method.documentationComment); 4357 expect(method.documentationComment, isNull);
4360 JUnitTestCase.assertNull(method.externalKeyword); 4358 expect(method.externalKeyword, isNull);
4361 JUnitTestCase.assertNull(method.modifierKeyword); 4359 expect(method.modifierKeyword, isNull);
4362 JUnitTestCase.assertNotNull(method.propertyKeyword); 4360 expect(method.propertyKeyword, isNotNull);
4363 JUnitTestCase.assertNotNull(method.returnType); 4361 expect(method.returnType, isNotNull);
4364 JUnitTestCase.assertNotNull(method.name); 4362 expect(method.name, isNotNull);
4365 JUnitTestCase.assertNull(method.operatorKeyword); 4363 expect(method.operatorKeyword, isNull);
4366 JUnitTestCase.assertNotNull(method.body); 4364 expect(method.body, isNotNull);
4367 } 4365 }
4368 4366
4369 void test_parseClassMember_method_external() { 4367 void test_parseClassMember_method_external() {
4370 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external m();"); 4368 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external m();");
4371 JUnitTestCase.assertNotNull(method.body); 4369 expect(method.body, isNotNull);
4372 JUnitTestCase.assertNull(method.documentationComment); 4370 expect(method.documentationComment, isNull);
4373 JUnitTestCase.assertNotNull(method.externalKeyword); 4371 expect(method.externalKeyword, isNotNull);
4374 JUnitTestCase.assertNull(method.modifierKeyword); 4372 expect(method.modifierKeyword, isNull);
4375 JUnitTestCase.assertNotNull(method.name); 4373 expect(method.name, isNotNull);
4376 JUnitTestCase.assertNull(method.operatorKeyword); 4374 expect(method.operatorKeyword, isNull);
4377 JUnitTestCase.assertNotNull(method.parameters); 4375 expect(method.parameters, isNotNull);
4378 JUnitTestCase.assertNull(method.propertyKeyword); 4376 expect(method.propertyKeyword, isNull);
4379 JUnitTestCase.assertNull(method.returnType); 4377 expect(method.returnType, isNull);
4380 } 4378 }
4381 4379
4382 void test_parseClassMember_method_external_withTypeAndArgs() { 4380 void test_parseClassMember_method_external_withTypeAndArgs() {
4383 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external int m(int a);"); 4381 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external int m(int a);");
4384 JUnitTestCase.assertNotNull(method.body); 4382 expect(method.body, isNotNull);
4385 JUnitTestCase.assertNull(method.documentationComment); 4383 expect(method.documentationComment, isNull);
4386 JUnitTestCase.assertNotNull(method.externalKeyword); 4384 expect(method.externalKeyword, isNotNull);
4387 JUnitTestCase.assertNull(method.modifierKeyword); 4385 expect(method.modifierKeyword, isNull);
4388 JUnitTestCase.assertNotNull(method.name); 4386 expect(method.name, isNotNull);
4389 JUnitTestCase.assertNull(method.operatorKeyword); 4387 expect(method.operatorKeyword, isNull);
4390 JUnitTestCase.assertNotNull(method.parameters); 4388 expect(method.parameters, isNotNull);
4391 JUnitTestCase.assertNull(method.propertyKeyword); 4389 expect(method.propertyKeyword, isNull);
4392 JUnitTestCase.assertNotNull(method.returnType); 4390 expect(method.returnType, isNotNull);
4393 } 4391 }
4394 4392
4395 void test_parseClassMember_method_get_noType() { 4393 void test_parseClassMember_method_get_noType() {
4396 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "get() {}"); 4394 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "get() {}");
4397 JUnitTestCase.assertNull(method.documentationComment); 4395 expect(method.documentationComment, isNull);
4398 JUnitTestCase.assertNull(method.externalKeyword); 4396 expect(method.externalKeyword, isNull);
4399 JUnitTestCase.assertNull(method.modifierKeyword); 4397 expect(method.modifierKeyword, isNull);
4400 JUnitTestCase.assertNull(method.propertyKeyword); 4398 expect(method.propertyKeyword, isNull);
4401 JUnitTestCase.assertNull(method.returnType); 4399 expect(method.returnType, isNull);
4402 JUnitTestCase.assertNotNull(method.name); 4400 expect(method.name, isNotNull);
4403 JUnitTestCase.assertNull(method.operatorKeyword); 4401 expect(method.operatorKeyword, isNull);
4404 JUnitTestCase.assertNotNull(method.parameters); 4402 expect(method.parameters, isNotNull);
4405 JUnitTestCase.assertNotNull(method.body); 4403 expect(method.body, isNotNull);
4406 } 4404 }
4407 4405
4408 void test_parseClassMember_method_get_type() { 4406 void test_parseClassMember_method_get_type() {
4409 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int get() {}"); 4407 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int get() {}");
4410 JUnitTestCase.assertNull(method.documentationComment); 4408 expect(method.documentationComment, isNull);
4411 JUnitTestCase.assertNull(method.externalKeyword); 4409 expect(method.externalKeyword, isNull);
4412 JUnitTestCase.assertNull(method.modifierKeyword); 4410 expect(method.modifierKeyword, isNull);
4413 JUnitTestCase.assertNull(method.propertyKeyword); 4411 expect(method.propertyKeyword, isNull);
4414 JUnitTestCase.assertNotNull(method.returnType); 4412 expect(method.returnType, isNotNull);
4415 JUnitTestCase.assertNotNull(method.name); 4413 expect(method.name, isNotNull);
4416 JUnitTestCase.assertNull(method.operatorKeyword); 4414 expect(method.operatorKeyword, isNull);
4417 JUnitTestCase.assertNotNull(method.parameters); 4415 expect(method.parameters, isNotNull);
4418 JUnitTestCase.assertNotNull(method.body); 4416 expect(method.body, isNotNull);
4419 } 4417 }
4420 4418
4421 void test_parseClassMember_method_get_void() { 4419 void test_parseClassMember_method_get_void() {
4422 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get() {}"); 4420 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get() {}");
4423 JUnitTestCase.assertNull(method.documentationComment); 4421 expect(method.documentationComment, isNull);
4424 JUnitTestCase.assertNull(method.externalKeyword); 4422 expect(method.externalKeyword, isNull);
4425 JUnitTestCase.assertNull(method.modifierKeyword); 4423 expect(method.modifierKeyword, isNull);
4426 JUnitTestCase.assertNull(method.propertyKeyword); 4424 expect(method.propertyKeyword, isNull);
4427 JUnitTestCase.assertNotNull(method.returnType); 4425 expect(method.returnType, isNotNull);
4428 JUnitTestCase.assertNotNull(method.name); 4426 expect(method.name, isNotNull);
4429 JUnitTestCase.assertNull(method.operatorKeyword); 4427 expect(method.operatorKeyword, isNull);
4430 JUnitTestCase.assertNotNull(method.parameters); 4428 expect(method.parameters, isNotNull);
4431 JUnitTestCase.assertNotNull(method.body); 4429 expect(method.body, isNotNull);
4432 } 4430 }
4433 4431
4434 void test_parseClassMember_method_operator_noType() { 4432 void test_parseClassMember_method_operator_noType() {
4435 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "operator() {}"); 4433 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "operator() {}");
4436 JUnitTestCase.assertNull(method.documentationComment); 4434 expect(method.documentationComment, isNull);
4437 JUnitTestCase.assertNull(method.externalKeyword); 4435 expect(method.externalKeyword, isNull);
4438 JUnitTestCase.assertNull(method.modifierKeyword); 4436 expect(method.modifierKeyword, isNull);
4439 JUnitTestCase.assertNull(method.propertyKeyword); 4437 expect(method.propertyKeyword, isNull);
4440 JUnitTestCase.assertNull(method.returnType); 4438 expect(method.returnType, isNull);
4441 JUnitTestCase.assertNotNull(method.name); 4439 expect(method.name, isNotNull);
4442 JUnitTestCase.assertNull(method.operatorKeyword); 4440 expect(method.operatorKeyword, isNull);
4443 JUnitTestCase.assertNotNull(method.parameters); 4441 expect(method.parameters, isNotNull);
4444 JUnitTestCase.assertNotNull(method.body); 4442 expect(method.body, isNotNull);
4445 } 4443 }
4446 4444
4447 void test_parseClassMember_method_operator_type() { 4445 void test_parseClassMember_method_operator_type() {
4448 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator() {}"); 4446 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator() {}");
4449 JUnitTestCase.assertNull(method.documentationComment); 4447 expect(method.documentationComment, isNull);
4450 JUnitTestCase.assertNull(method.externalKeyword); 4448 expect(method.externalKeyword, isNull);
4451 JUnitTestCase.assertNull(method.modifierKeyword); 4449 expect(method.modifierKeyword, isNull);
4452 JUnitTestCase.assertNull(method.propertyKeyword); 4450 expect(method.propertyKeyword, isNull);
4453 JUnitTestCase.assertNotNull(method.returnType); 4451 expect(method.returnType, isNotNull);
4454 JUnitTestCase.assertNotNull(method.name); 4452 expect(method.name, isNotNull);
4455 JUnitTestCase.assertNull(method.operatorKeyword); 4453 expect(method.operatorKeyword, isNull);
4456 JUnitTestCase.assertNotNull(method.parameters); 4454 expect(method.parameters, isNotNull);
4457 JUnitTestCase.assertNotNull(method.body); 4455 expect(method.body, isNotNull);
4458 } 4456 }
4459 4457
4460 void test_parseClassMember_method_operator_void() { 4458 void test_parseClassMember_method_operator_void() {
4461 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void operator() {}"); 4459 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void operator() {}");
4462 JUnitTestCase.assertNull(method.documentationComment); 4460 expect(method.documentationComment, isNull);
4463 JUnitTestCase.assertNull(method.externalKeyword); 4461 expect(method.externalKeyword, isNull);
4464 JUnitTestCase.assertNull(method.modifierKeyword); 4462 expect(method.modifierKeyword, isNull);
4465 JUnitTestCase.assertNull(method.propertyKeyword); 4463 expect(method.propertyKeyword, isNull);
4466 JUnitTestCase.assertNotNull(method.returnType); 4464 expect(method.returnType, isNotNull);
4467 JUnitTestCase.assertNotNull(method.name); 4465 expect(method.name, isNotNull);
4468 JUnitTestCase.assertNull(method.operatorKeyword); 4466 expect(method.operatorKeyword, isNull);
4469 JUnitTestCase.assertNotNull(method.parameters); 4467 expect(method.parameters, isNotNull);
4470 JUnitTestCase.assertNotNull(method.body); 4468 expect(method.body, isNotNull);
4471 } 4469 }
4472 4470
4473 void test_parseClassMember_method_returnType_parameterized() { 4471 void test_parseClassMember_method_returnType_parameterized() {
4474 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A m() {}"); 4472 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A m() {}");
4475 JUnitTestCase.assertNull(method.documentationComment); 4473 expect(method.documentationComment, isNull);
4476 JUnitTestCase.assertNull(method.externalKeyword); 4474 expect(method.externalKeyword, isNull);
4477 JUnitTestCase.assertNull(method.modifierKeyword); 4475 expect(method.modifierKeyword, isNull);
4478 JUnitTestCase.assertNull(method.propertyKeyword); 4476 expect(method.propertyKeyword, isNull);
4479 JUnitTestCase.assertNotNull(method.returnType); 4477 expect(method.returnType, isNotNull);
4480 JUnitTestCase.assertNotNull(method.name); 4478 expect(method.name, isNotNull);
4481 JUnitTestCase.assertNull(method.operatorKeyword); 4479 expect(method.operatorKeyword, isNull);
4482 JUnitTestCase.assertNotNull(method.parameters); 4480 expect(method.parameters, isNotNull);
4483 JUnitTestCase.assertNotNull(method.body); 4481 expect(method.body, isNotNull);
4484 } 4482 }
4485 4483
4486 void test_parseClassMember_method_set_noType() { 4484 void test_parseClassMember_method_set_noType() {
4487 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "set() {}"); 4485 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "set() {}");
4488 JUnitTestCase.assertNull(method.documentationComment); 4486 expect(method.documentationComment, isNull);
4489 JUnitTestCase.assertNull(method.externalKeyword); 4487 expect(method.externalKeyword, isNull);
4490 JUnitTestCase.assertNull(method.modifierKeyword); 4488 expect(method.modifierKeyword, isNull);
4491 JUnitTestCase.assertNull(method.propertyKeyword); 4489 expect(method.propertyKeyword, isNull);
4492 JUnitTestCase.assertNull(method.returnType); 4490 expect(method.returnType, isNull);
4493 JUnitTestCase.assertNotNull(method.name); 4491 expect(method.name, isNotNull);
4494 JUnitTestCase.assertNull(method.operatorKeyword); 4492 expect(method.operatorKeyword, isNull);
4495 JUnitTestCase.assertNotNull(method.parameters); 4493 expect(method.parameters, isNotNull);
4496 JUnitTestCase.assertNotNull(method.body); 4494 expect(method.body, isNotNull);
4497 } 4495 }
4498 4496
4499 void test_parseClassMember_method_set_type() { 4497 void test_parseClassMember_method_set_type() {
4500 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int set() {}"); 4498 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int set() {}");
4501 JUnitTestCase.assertNull(method.documentationComment); 4499 expect(method.documentationComment, isNull);
4502 JUnitTestCase.assertNull(method.externalKeyword); 4500 expect(method.externalKeyword, isNull);
4503 JUnitTestCase.assertNull(method.modifierKeyword); 4501 expect(method.modifierKeyword, isNull);
4504 JUnitTestCase.assertNull(method.propertyKeyword); 4502 expect(method.propertyKeyword, isNull);
4505 JUnitTestCase.assertNotNull(method.returnType); 4503 expect(method.returnType, isNotNull);
4506 JUnitTestCase.assertNotNull(method.name); 4504 expect(method.name, isNotNull);
4507 JUnitTestCase.assertNull(method.operatorKeyword); 4505 expect(method.operatorKeyword, isNull);
4508 JUnitTestCase.assertNotNull(method.parameters); 4506 expect(method.parameters, isNotNull);
4509 JUnitTestCase.assertNotNull(method.body); 4507 expect(method.body, isNotNull);
4510 } 4508 }
4511 4509
4512 void test_parseClassMember_method_set_void() { 4510 void test_parseClassMember_method_set_void() {
4513 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void set() {}"); 4511 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void set() {}");
4514 JUnitTestCase.assertNull(method.documentationComment); 4512 expect(method.documentationComment, isNull);
4515 JUnitTestCase.assertNull(method.externalKeyword); 4513 expect(method.externalKeyword, isNull);
4516 JUnitTestCase.assertNull(method.modifierKeyword); 4514 expect(method.modifierKeyword, isNull);
4517 JUnitTestCase.assertNull(method.propertyKeyword); 4515 expect(method.propertyKeyword, isNull);
4518 JUnitTestCase.assertNotNull(method.returnType); 4516 expect(method.returnType, isNotNull);
4519 JUnitTestCase.assertNotNull(method.name); 4517 expect(method.name, isNotNull);
4520 JUnitTestCase.assertNull(method.operatorKeyword); 4518 expect(method.operatorKeyword, isNull);
4521 JUnitTestCase.assertNotNull(method.parameters); 4519 expect(method.parameters, isNotNull);
4522 JUnitTestCase.assertNotNull(method.body); 4520 expect(method.body, isNotNull);
4523 } 4521 }
4524 4522
4525 void test_parseClassMember_operator_index() { 4523 void test_parseClassMember_operator_index() {
4526 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator [](int i) {}"); 4524 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator [](int i) {}");
4527 JUnitTestCase.assertNull(method.documentationComment); 4525 expect(method.documentationComment, isNull);
4528 JUnitTestCase.assertNull(method.externalKeyword); 4526 expect(method.externalKeyword, isNull);
4529 JUnitTestCase.assertNull(method.modifierKeyword); 4527 expect(method.modifierKeyword, isNull);
4530 JUnitTestCase.assertNull(method.propertyKeyword); 4528 expect(method.propertyKeyword, isNull);
4531 JUnitTestCase.assertNotNull(method.returnType); 4529 expect(method.returnType, isNotNull);
4532 JUnitTestCase.assertNotNull(method.name); 4530 expect(method.name, isNotNull);
4533 JUnitTestCase.assertNotNull(method.operatorKeyword); 4531 expect(method.operatorKeyword, isNotNull);
4534 JUnitTestCase.assertNotNull(method.parameters); 4532 expect(method.parameters, isNotNull);
4535 JUnitTestCase.assertNotNull(method.body); 4533 expect(method.body, isNotNull);
4536 } 4534 }
4537 4535
4538 void test_parseClassMember_operator_indexAssign() { 4536 void test_parseClassMember_operator_indexAssign() {
4539 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator []=(int i) {}"); 4537 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator []=(int i) {}");
4540 JUnitTestCase.assertNull(method.documentationComment); 4538 expect(method.documentationComment, isNull);
4541 JUnitTestCase.assertNull(method.externalKeyword); 4539 expect(method.externalKeyword, isNull);
4542 JUnitTestCase.assertNull(method.modifierKeyword); 4540 expect(method.modifierKeyword, isNull);
4543 JUnitTestCase.assertNull(method.propertyKeyword); 4541 expect(method.propertyKeyword, isNull);
4544 JUnitTestCase.assertNotNull(method.returnType); 4542 expect(method.returnType, isNotNull);
4545 JUnitTestCase.assertNotNull(method.name); 4543 expect(method.name, isNotNull);
4546 JUnitTestCase.assertNotNull(method.operatorKeyword); 4544 expect(method.operatorKeyword, isNotNull);
4547 JUnitTestCase.assertNotNull(method.parameters); 4545 expect(method.parameters, isNotNull);
4548 JUnitTestCase.assertNotNull(method.body); 4546 expect(method.body, isNotNull);
4549 } 4547 }
4550 4548
4551 void test_parseClassMember_redirectingFactory_const() { 4549 void test_parseClassMember_redirectingFactory_const() {
4552 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;"); 4550 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;");
4553 JUnitTestCase.assertNull(constructor.externalKeyword); 4551 expect(constructor.externalKeyword, isNull);
4554 JUnitTestCase.assertNotNull(constructor.constKeyword); 4552 expect(constructor.constKeyword, isNotNull);
4555 JUnitTestCase.assertNotNull(constructor.factoryKeyword); 4553 expect(constructor.factoryKeyword, isNotNull);
4556 JUnitTestCase.assertNotNull(constructor.returnType); 4554 expect(constructor.returnType, isNotNull);
4557 JUnitTestCase.assertNull(constructor.period); 4555 expect(constructor.period, isNull);
4558 JUnitTestCase.assertNull(constructor.name); 4556 expect(constructor.name, isNull);
4559 JUnitTestCase.assertNotNull(constructor.parameters); 4557 expect(constructor.parameters, isNotNull);
4560 JUnitTestCase.assertNotNull(constructor.separator); 4558 expect(constructor.separator, isNotNull);
4561 EngineTestCase.assertSizeOfList(0, constructor.initializers); 4559 EngineTestCase.assertSizeOfList(0, constructor.initializers);
4562 JUnitTestCase.assertNotNull(constructor.redirectedConstructor); 4560 expect(constructor.redirectedConstructor, isNotNull);
4563 JUnitTestCase.assertNotNull(constructor.body); 4561 expect(constructor.body, isNotNull);
4564 } 4562 }
4565 4563
4566 void test_parseClassMember_redirectingFactory_nonConst() { 4564 void test_parseClassMember_redirectingFactory_nonConst() {
4567 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;"); 4565 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;");
4568 JUnitTestCase.assertNull(constructor.externalKeyword); 4566 expect(constructor.externalKeyword, isNull);
4569 JUnitTestCase.assertNull(constructor.constKeyword); 4567 expect(constructor.constKeyword, isNull);
4570 JUnitTestCase.assertNotNull(constructor.factoryKeyword); 4568 expect(constructor.factoryKeyword, isNotNull);
4571 JUnitTestCase.assertNotNull(constructor.returnType); 4569 expect(constructor.returnType, isNotNull);
4572 JUnitTestCase.assertNull(constructor.period); 4570 expect(constructor.period, isNull);
4573 JUnitTestCase.assertNull(constructor.name); 4571 expect(constructor.name, isNull);
4574 JUnitTestCase.assertNotNull(constructor.parameters); 4572 expect(constructor.parameters, isNotNull);
4575 JUnitTestCase.assertNotNull(constructor.separator); 4573 expect(constructor.separator, isNotNull);
4576 EngineTestCase.assertSizeOfList(0, constructor.initializers); 4574 EngineTestCase.assertSizeOfList(0, constructor.initializers);
4577 JUnitTestCase.assertNotNull(constructor.redirectedConstructor); 4575 expect(constructor.redirectedConstructor, isNotNull);
4578 JUnitTestCase.assertNotNull(constructor.body); 4576 expect(constructor.body, isNotNull);
4579 } 4577 }
4580 4578
4581 void test_parseClassTypeAlias_abstract() { 4579 void test_parseClassTypeAlias_abstract() {
4582 Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS); 4580 Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
4583 Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT); 4581 Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT);
4584 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;" );
4585 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 4583 expect(classTypeAlias.keyword, isNotNull);
4586 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 4584 expect(classTypeAlias.name.name, "A");
4587 JUnitTestCase.assertNotNull(classTypeAlias.equals); 4585 expect(classTypeAlias.equals, isNotNull);
4588 JUnitTestCase.assertNotNull(classTypeAlias.abstractKeyword); 4586 expect(classTypeAlias.abstractKeyword, isNotNull);
4589 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 4587 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
4590 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 4588 expect(classTypeAlias.withClause, isNotNull);
4591 JUnitTestCase.assertNull(classTypeAlias.implementsClause); 4589 expect(classTypeAlias.implementsClause, isNull);
4592 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 4590 expect(classTypeAlias.semicolon, isNotNull);
4593 } 4591 }
4594 4592
4595 void test_parseClassTypeAlias_implements() { 4593 void test_parseClassTypeAlias_implements() {
4596 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS); 4594 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
4597 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;") ; 4595 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;") ;
4598 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 4596 expect(classTypeAlias.keyword, isNotNull);
4599 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 4597 expect(classTypeAlias.name.name, "A");
4600 JUnitTestCase.assertNotNull(classTypeAlias.equals); 4598 expect(classTypeAlias.equals, isNotNull);
4601 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 4599 expect(classTypeAlias.abstractKeyword, isNull);
4602 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 4600 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
4603 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 4601 expect(classTypeAlias.withClause, isNotNull);
4604 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause); 4602 expect(classTypeAlias.implementsClause, isNotNull);
4605 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 4603 expect(classTypeAlias.semicolon, isNotNull);
4606 } 4604 }
4607 4605
4608 void test_parseClassTypeAlias_with() { 4606 void test_parseClassTypeAlias_with() {
4609 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS); 4607 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
4610 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C;"); 4608 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C;");
4611 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 4609 expect(classTypeAlias.keyword, isNotNull);
4612 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 4610 expect(classTypeAlias.name.name, "A");
4613 JUnitTestCase.assertNotNull(classTypeAlias.equals); 4611 expect(classTypeAlias.equals, isNotNull);
4614 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 4612 expect(classTypeAlias.abstractKeyword, isNull);
4615 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 4613 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
4616 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 4614 expect(classTypeAlias.withClause, isNotNull);
4617 JUnitTestCase.assertNull(classTypeAlias.implementsClause); 4615 expect(classTypeAlias.implementsClause, isNull);
4618 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 4616 expect(classTypeAlias.semicolon, isNotNull);
4619 } 4617 }
4620 4618
4621 void test_parseClassTypeAlias_with_implements() { 4619 void test_parseClassTypeAlias_with_implements() {
4622 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS); 4620 Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
4623 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;") ; 4621 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;") ;
4624 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 4622 expect(classTypeAlias.keyword, isNotNull);
4625 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 4623 expect(classTypeAlias.name.name, "A");
4626 JUnitTestCase.assertNotNull(classTypeAlias.equals); 4624 expect(classTypeAlias.equals, isNotNull);
4627 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 4625 expect(classTypeAlias.abstractKeyword, isNull);
4628 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 4626 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
4629 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 4627 expect(classTypeAlias.withClause, isNotNull);
4630 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause); 4628 expect(classTypeAlias.implementsClause, isNotNull);
4631 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 4629 expect(classTypeAlias.semicolon, isNotNull);
4632 } 4630 }
4633 4631
4634 void test_parseCombinators_h() { 4632 void test_parseCombinators_h() {
4635 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a;", []); 4633 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a;", []);
4636 EngineTestCase.assertSizeOfList(1, combinators); 4634 EngineTestCase.assertSizeOfList(1, combinators);
4637 HideCombinator combinator = combinators[0] as HideCombinator; 4635 HideCombinator combinator = combinators[0] as HideCombinator;
4638 JUnitTestCase.assertNotNull(combinator); 4636 expect(combinator, isNotNull);
4639 JUnitTestCase.assertNotNull(combinator.keyword); 4637 expect(combinator.keyword, isNotNull);
4640 EngineTestCase.assertSizeOfList(1, combinator.hiddenNames); 4638 EngineTestCase.assertSizeOfList(1, combinator.hiddenNames);
4641 } 4639 }
4642 4640
4643 void test_parseCombinators_hs() { 4641 void test_parseCombinators_hs() {
4644 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b;", []); 4642 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hi de a show b;", []);
4645 EngineTestCase.assertSizeOfList(2, combinators); 4643 EngineTestCase.assertSizeOfList(2, combinators);
4646 HideCombinator hideCombinator = combinators[0] as HideCombinator; 4644 HideCombinator hideCombinator = combinators[0] as HideCombinator;
4647 JUnitTestCase.assertNotNull(hideCombinator); 4645 expect(hideCombinator, isNotNull);
4648 JUnitTestCase.assertNotNull(hideCombinator.keyword); 4646 expect(hideCombinator.keyword, isNotNull);
4649 EngineTestCase.assertSizeOfList(1, hideCombinator.hiddenNames); 4647 EngineTestCase.assertSizeOfList(1, hideCombinator.hiddenNames);
4650 ShowCombinator showCombinator = combinators[1] as ShowCombinator; 4648 ShowCombinator showCombinator = combinators[1] as ShowCombinator;
4651 JUnitTestCase.assertNotNull(showCombinator); 4649 expect(showCombinator, isNotNull);
4652 JUnitTestCase.assertNotNull(showCombinator.keyword); 4650 expect(showCombinator.keyword, isNotNull);
4653 EngineTestCase.assertSizeOfList(1, showCombinator.shownNames); 4651 EngineTestCase.assertSizeOfList(1, showCombinator.shownNames);
4654 } 4652 }
4655 4653
4656 void test_parseCombinators_hshs() { 4654 void test_parseCombinators_hshs() {
4657 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;", []);
4658 EngineTestCase.assertSizeOfList(4, combinators); 4656 EngineTestCase.assertSizeOfList(4, combinators);
4659 } 4657 }
4660 4658
4661 void test_parseCombinators_s() { 4659 void test_parseCombinators_s() {
4662 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "sh ow a;", []); 4660 List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "sh ow a;", []);
4663 EngineTestCase.assertSizeOfList(1, combinators); 4661 EngineTestCase.assertSizeOfList(1, combinators);
4664 ShowCombinator combinator = combinators[0] as ShowCombinator; 4662 ShowCombinator combinator = combinators[0] as ShowCombinator;
4665 JUnitTestCase.assertNotNull(combinator); 4663 expect(combinator, isNotNull);
4666 JUnitTestCase.assertNotNull(combinator.keyword); 4664 expect(combinator.keyword, isNotNull);
4667 EngineTestCase.assertSizeOfList(1, combinator.shownNames); 4665 EngineTestCase.assertSizeOfList(1, combinator.shownNames);
4668 } 4666 }
4669 4667
4670 void test_parseCommentAndMetadata_c() { 4668 void test_parseCommentAndMetadata_c() {
4671 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ void", []); 4669 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ void", []);
4672 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4670 expect(commentAndMetadata.comment, isNotNull);
4673 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4671 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata);
4674 } 4672 }
4675 4673
4676 void test_parseCommentAndMetadata_cmc() { 4674 void test_parseCommentAndMetadata_cmc() {
4677 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []); 4675 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []);
4678 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4676 expect(commentAndMetadata.comment, isNotNull);
4679 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata); 4677 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata);
4680 } 4678 }
4681 4679
4682 void test_parseCommentAndMetadata_cmcm() { 4680 void test_parseCommentAndMetadata_cmcm() {
4683 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []); 4681 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []);
4684 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4682 expect(commentAndMetadata.comment, isNotNull);
4685 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4683 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata);
4686 } 4684 }
4687 4685
4688 void test_parseCommentAndMetadata_cmm() { 4686 void test_parseCommentAndMetadata_cmm() {
4689 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A @B void", []); 4687 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "/** 1 */ @A @B void", []);
4690 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4688 expect(commentAndMetadata.comment, isNotNull);
4691 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4689 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata);
4692 } 4690 }
4693 4691
4694 void test_parseCommentAndMetadata_m() { 4692 void test_parseCommentAndMetadata_m() {
4695 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A void", []); 4693 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A void", []);
4696 JUnitTestCase.assertNull(commentAndMetadata.comment); 4694 expect(commentAndMetadata.comment, isNull);
4697 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata); 4695 EngineTestCase.assertSizeOfList(1, commentAndMetadata.metadata);
4698 } 4696 }
4699 4697
4700 void test_parseCommentAndMetadata_mcm() { 4698 void test_parseCommentAndMetadata_mcm() {
4701 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B void", []); 4699 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B void", []);
4702 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4700 expect(commentAndMetadata.comment, isNotNull);
4703 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4701 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata);
4704 } 4702 }
4705 4703
4706 void test_parseCommentAndMetadata_mcmc() { 4704 void test_parseCommentAndMetadata_mcmc() {
4707 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []); 4705 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []);
4708 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4706 expect(commentAndMetadata.comment, isNotNull);
4709 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4707 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata);
4710 } 4708 }
4711 4709
4712 void test_parseCommentAndMetadata_mm() { 4710 void test_parseCommentAndMetadata_mm() {
4713 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A @B(x) void", []); 4711 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "@A @B(x) void", []);
4714 JUnitTestCase.assertNull(commentAndMetadata.comment); 4712 expect(commentAndMetadata.comment, isNull);
4715 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata); 4713 EngineTestCase.assertSizeOfList(2, commentAndMetadata.metadata);
4716 } 4714 }
4717 4715
4718 void test_parseCommentAndMetadata_none() { 4716 void test_parseCommentAndMetadata_none() {
4719 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "void", []); 4717 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", "void", []);
4720 JUnitTestCase.assertNull(commentAndMetadata.comment); 4718 expect(commentAndMetadata.comment, isNull);
4721 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4719 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata);
4722 } 4720 }
4723 4721
4724 void test_parseCommentAndMetadata_singleLine() { 4722 void test_parseCommentAndMetadata_singleLine() {
4725 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", r''' 4723 CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentA ndMetadata", r'''
4726 /// 1 4724 /// 1
4727 /// 2 4725 /// 2
4728 void''', []); 4726 void''', []);
4729 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 4727 expect(commentAndMetadata.comment, isNotNull);
4730 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata); 4728 EngineTestCase.assertSizeOfList(0, commentAndMetadata.metadata);
4731 } 4729 }
4732 4730
4733 void test_parseCommentReference_new_prefixed() { 4731 void test_parseCommentReference_new_prefixed() {
4734 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], ""); 4732 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], "");
4735 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier); 4733 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier);
4736 SimpleIdentifier prefix = prefixedIdentifier.prefix; 4734 SimpleIdentifier prefix = prefixedIdentifier.prefix;
4737 JUnitTestCase.assertNotNull(prefix.token); 4735 expect(prefix.token, isNotNull);
4738 JUnitTestCase.assertEquals("a", prefix.name); 4736 expect(prefix.name, "a");
4739 JUnitTestCase.assertEquals(11, prefix.offset); 4737 expect(prefix.offset, 11);
4740 JUnitTestCase.assertNotNull(prefixedIdentifier.period); 4738 expect(prefixedIdentifier.period, isNotNull);
4741 SimpleIdentifier identifier = prefixedIdentifier.identifier; 4739 SimpleIdentifier identifier = prefixedIdentifier.identifier;
4742 JUnitTestCase.assertNotNull(identifier.token); 4740 expect(identifier.token, isNotNull);
4743 JUnitTestCase.assertEquals("b", identifier.name); 4741 expect(identifier.name, "b");
4744 JUnitTestCase.assertEquals(13, identifier.offset); 4742 expect(identifier.offset, 13);
4745 } 4743 }
4746 4744
4747 void test_parseCommentReference_new_simple() { 4745 void test_parseCommentReference_new_simple() {
4748 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a", 5], ""); 4746 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a", 5], "");
4749 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier); 4747 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier);
4750 JUnitTestCase.assertNotNull(identifier.token); 4748 expect(identifier.token, isNotNull);
4751 JUnitTestCase.assertEquals("a", identifier.name); 4749 expect(identifier.name, "a");
4752 JUnitTestCase.assertEquals(9, identifier.offset); 4750 expect(identifier.offset, 9);
4753 } 4751 }
4754 4752
4755 void test_parseCommentReference_prefixed() { 4753 void test_parseCommentReference_prefixed() {
4756 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a.b", 7], ""); 4754 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a.b", 7], "");
4757 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier); 4755 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj ) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier);
4758 SimpleIdentifier prefix = prefixedIdentifier.prefix; 4756 SimpleIdentifier prefix = prefixedIdentifier.prefix;
4759 JUnitTestCase.assertNotNull(prefix.token); 4757 expect(prefix.token, isNotNull);
4760 JUnitTestCase.assertEquals("a", prefix.name); 4758 expect(prefix.name, "a");
4761 JUnitTestCase.assertEquals(7, prefix.offset); 4759 expect(prefix.offset, 7);
4762 JUnitTestCase.assertNotNull(prefixedIdentifier.period); 4760 expect(prefixedIdentifier.period, isNotNull);
4763 SimpleIdentifier identifier = prefixedIdentifier.identifier; 4761 SimpleIdentifier identifier = prefixedIdentifier.identifier;
4764 JUnitTestCase.assertNotNull(identifier.token); 4762 expect(identifier.token, isNotNull);
4765 JUnitTestCase.assertEquals("b", identifier.name); 4763 expect(identifier.name, "b");
4766 JUnitTestCase.assertEquals(9, identifier.offset); 4764 expect(identifier.offset, 9);
4767 } 4765 }
4768 4766
4769 void test_parseCommentReference_simple() { 4767 void test_parseCommentReference_simple() {
4770 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a", 5], ""); 4768 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a", 5], "");
4771 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier); 4769 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier);
4772 JUnitTestCase.assertNotNull(identifier.token); 4770 expect(identifier.token, isNotNull);
4773 JUnitTestCase.assertEquals("a", identifier.name); 4771 expect(identifier.name, "a");
4774 JUnitTestCase.assertEquals(5, identifier.offset); 4772 expect(identifier.offset, 5);
4775 } 4773 }
4776 4774
4777 void test_parseCommentReference_synthetic() { 4775 void test_parseCommentReference_synthetic() {
4778 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["", 5], ""); 4776 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["", 5], "");
4779 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier); 4777 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj i s SimpleIdentifier, SimpleIdentifier, reference.identifier);
4780 JUnitTestCase.assertNotNull(identifier); 4778 expect(identifier, isNotNull);
4781 JUnitTestCase.assertTrue(identifier.isSynthetic); 4779 expect(identifier.isSynthetic, isTrue);
4782 JUnitTestCase.assertNotNull(identifier.token); 4780 expect(identifier.token, isNotNull);
4783 JUnitTestCase.assertEquals("", identifier.name); 4781 expect(identifier.name, "");
4784 JUnitTestCase.assertEquals(5, identifier.offset); 4782 expect(identifier.offset, 5);
4785 } 4783 }
4786 4784
4787 void test_parseCommentReferences_multiLine() { 4785 void test_parseCommentReferences_multiLine() {
4788 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)];
4789 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4787 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4790 EngineTestCase.assertSizeOfList(2, references); 4788 EngineTestCase.assertSizeOfList(2, references);
4791 CommentReference reference = references[0]; 4789 CommentReference reference = references[0];
4792 JUnitTestCase.assertNotNull(reference); 4790 expect(reference, isNotNull);
4793 JUnitTestCase.assertNotNull(reference.identifier); 4791 expect(reference.identifier, isNotNull);
4794 JUnitTestCase.assertEquals(12, reference.offset); 4792 expect(reference.offset, 12);
4795 reference = references[1]; 4793 reference = references[1];
4796 JUnitTestCase.assertNotNull(reference); 4794 expect(reference, isNotNull);
4797 JUnitTestCase.assertNotNull(reference.identifier); 4795 expect(reference.identifier, isNotNull);
4798 JUnitTestCase.assertEquals(20, reference.offset); 4796 expect(reference.offset, 20);
4799 } 4797 }
4800 4798
4801 void test_parseCommentReferences_notClosed_noIdentifier() { 4799 void test_parseCommentReferences_notClosed_noIdentifier() {
4802 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)];
4803 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4801 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4804 EngineTestCase.assertSizeOfList(1, references); 4802 EngineTestCase.assertSizeOfList(1, references);
4805 CommentReference reference = references[0]; 4803 CommentReference reference = references[0];
4806 JUnitTestCase.assertNotNull(reference); 4804 expect(reference, isNotNull);
4807 JUnitTestCase.assertNotNull(reference.identifier); 4805 expect(reference.identifier, isNotNull);
4808 JUnitTestCase.assertTrue(reference.identifier.isSynthetic); 4806 expect(reference.identifier.isSynthetic, isTrue);
4809 JUnitTestCase.assertEquals("", reference.identifier.name); 4807 expect(reference.identifier.name, "");
4810 } 4808 }
4811 4809
4812 void test_parseCommentReferences_notClosed_withIdentifier() { 4810 void test_parseCommentReferences_notClosed_withIdentifier() {
4813 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)];
4814 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4812 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4815 EngineTestCase.assertSizeOfList(1, references); 4813 EngineTestCase.assertSizeOfList(1, references);
4816 CommentReference reference = references[0]; 4814 CommentReference reference = references[0];
4817 JUnitTestCase.assertNotNull(reference); 4815 expect(reference, isNotNull);
4818 JUnitTestCase.assertNotNull(reference.identifier); 4816 expect(reference.identifier, isNotNull);
4819 JUnitTestCase.assertFalse(reference.identifier.isSynthetic); 4817 expect(reference.identifier.isSynthetic, isFalse);
4820 JUnitTestCase.assertEquals("namePrefix", reference.identifier.name); 4818 expect(reference.identifier.name, "namePrefix");
4821 } 4819 }
4822 4820
4823 void test_parseCommentReferences_singleLine() { 4821 void test_parseCommentReferences_singleLine() {
4824 List<Token> tokens = <Token> [ 4822 List<Token> tokens = <Token> [
4825 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),
4826 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)]; 4824 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)];
4827 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4825 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4828 EngineTestCase.assertSizeOfList(3, references); 4826 EngineTestCase.assertSizeOfList(3, references);
4829 CommentReference reference = references[0]; 4827 CommentReference reference = references[0];
4830 JUnitTestCase.assertNotNull(reference); 4828 expect(reference, isNotNull);
4831 JUnitTestCase.assertNotNull(reference.identifier); 4829 expect(reference.identifier, isNotNull);
4832 JUnitTestCase.assertEquals(12, reference.offset); 4830 expect(reference.offset, 12);
4833 reference = references[1]; 4831 reference = references[1];
4834 JUnitTestCase.assertNotNull(reference); 4832 expect(reference, isNotNull);
4835 JUnitTestCase.assertNotNull(reference.identifier); 4833 expect(reference.identifier, isNotNull);
4836 JUnitTestCase.assertEquals(20, reference.offset); 4834 expect(reference.offset, 20);
4837 reference = references[2]; 4835 reference = references[2];
4838 JUnitTestCase.assertNotNull(reference); 4836 expect(reference, isNotNull);
4839 JUnitTestCase.assertNotNull(reference.identifier); 4837 expect(reference.identifier, isNotNull);
4840 JUnitTestCase.assertEquals(35, reference.offset); 4838 expect(reference.offset, 35);
4841 } 4839 }
4842 4840
4843 void test_parseCommentReferences_skipCodeBlock_bracketed() { 4841 void test_parseCommentReferences_skipCodeBlock_bracketed() {
4844 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)];
4845 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4843 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4846 EngineTestCase.assertSizeOfList(1, references); 4844 EngineTestCase.assertSizeOfList(1, references);
4847 CommentReference reference = references[0]; 4845 CommentReference reference = references[0];
4848 JUnitTestCase.assertNotNull(reference); 4846 expect(reference, isNotNull);
4849 JUnitTestCase.assertNotNull(reference.identifier); 4847 expect(reference.identifier, isNotNull);
4850 JUnitTestCase.assertEquals(24, reference.offset); 4848 expect(reference.offset, 24);
4851 } 4849 }
4852 4850
4853 void test_parseCommentReferences_skipCodeBlock_spaces() { 4851 void test_parseCommentReferences_skipCodeBlock_spaces() {
4854 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)];
4855 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4853 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4856 EngineTestCase.assertSizeOfList(1, references); 4854 EngineTestCase.assertSizeOfList(1, references);
4857 CommentReference reference = references[0]; 4855 CommentReference reference = references[0];
4858 JUnitTestCase.assertNotNull(reference); 4856 expect(reference, isNotNull);
4859 JUnitTestCase.assertNotNull(reference.identifier); 4857 expect(reference.identifier, isNotNull);
4860 JUnitTestCase.assertEquals(27, reference.offset); 4858 expect(reference.offset, 27);
4861 } 4859 }
4862 4860
4863 void test_parseCommentReferences_skipLinkDefinition() { 4861 void test_parseCommentReferences_skipLinkDefinition() {
4864 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)];
4865 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4863 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4866 EngineTestCase.assertSizeOfList(1, references); 4864 EngineTestCase.assertSizeOfList(1, references);
4867 CommentReference reference = references[0]; 4865 CommentReference reference = references[0];
4868 JUnitTestCase.assertNotNull(reference); 4866 expect(reference, isNotNull);
4869 JUnitTestCase.assertNotNull(reference.identifier); 4867 expect(reference.identifier, isNotNull);
4870 JUnitTestCase.assertEquals(44, reference.offset); 4868 expect(reference.offset, 44);
4871 } 4869 }
4872 4870
4873 void test_parseCommentReferences_skipLinked() { 4871 void test_parseCommentReferences_skipLinked() {
4874 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)];
4875 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4873 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4876 EngineTestCase.assertSizeOfList(1, references); 4874 EngineTestCase.assertSizeOfList(1, references);
4877 CommentReference reference = references[0]; 4875 CommentReference reference = references[0];
4878 JUnitTestCase.assertNotNull(reference); 4876 expect(reference, isNotNull);
4879 JUnitTestCase.assertNotNull(reference.identifier); 4877 expect(reference.identifier, isNotNull);
4880 JUnitTestCase.assertEquals(35, reference.offset); 4878 expect(reference.offset, 35);
4881 } 4879 }
4882 4880
4883 void test_parseCommentReferences_skipReferenceLink() { 4881 void test_parseCommentReferences_skipReferenceLink() {
4884 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)];
4885 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 4883 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
4886 EngineTestCase.assertSizeOfList(1, references); 4884 EngineTestCase.assertSizeOfList(1, references);
4887 CommentReference reference = references[0]; 4885 CommentReference reference = references[0];
4888 JUnitTestCase.assertNotNull(reference); 4886 expect(reference, isNotNull);
4889 JUnitTestCase.assertNotNull(reference.identifier); 4887 expect(reference.identifier, isNotNull);
4890 JUnitTestCase.assertEquals(15, reference.offset); 4888 expect(reference.offset, 15);
4891 } 4889 }
4892 4890
4893 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { 4891 void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
4894 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();", []);
4895 JUnitTestCase.assertNull(unit.scriptTag); 4893 expect(unit.scriptTag, isNull);
4896 EngineTestCase.assertSizeOfList(0, unit.directives); 4894 EngineTestCase.assertSizeOfList(0, unit.directives);
4897 EngineTestCase.assertSizeOfList(1, unit.declarations); 4895 EngineTestCase.assertSizeOfList(1, unit.declarations);
4898 } 4896 }
4899 4897
4900 void test_parseCompilationUnit_builtIn_asFunctionName() { 4898 void test_parseCompilationUnit_builtIn_asFunctionName() {
4901 ParserTestCase.parse4("parseCompilationUnit", "abstract(x) => 0;", []); 4899 ParserTestCase.parse4("parseCompilationUnit", "abstract(x) => 0;", []);
4902 ParserTestCase.parse4("parseCompilationUnit", "as(x) => 0;", []); 4900 ParserTestCase.parse4("parseCompilationUnit", "as(x) => 0;", []);
4903 ParserTestCase.parse4("parseCompilationUnit", "dynamic(x) => 0;", []); 4901 ParserTestCase.parse4("parseCompilationUnit", "dynamic(x) => 0;", []);
4904 ParserTestCase.parse4("parseCompilationUnit", "export(x) => 0;", []); 4902 ParserTestCase.parse4("parseCompilationUnit", "export(x) => 0;", []);
4905 ParserTestCase.parse4("parseCompilationUnit", "external(x) => 0;", []); 4903 ParserTestCase.parse4("parseCompilationUnit", "external(x) => 0;", []);
4906 ParserTestCase.parse4("parseCompilationUnit", "factory(x) => 0;", []); 4904 ParserTestCase.parse4("parseCompilationUnit", "factory(x) => 0;", []);
4907 ParserTestCase.parse4("parseCompilationUnit", "get(x) => 0;", []); 4905 ParserTestCase.parse4("parseCompilationUnit", "get(x) => 0;", []);
4908 ParserTestCase.parse4("parseCompilationUnit", "implements(x) => 0;", []); 4906 ParserTestCase.parse4("parseCompilationUnit", "implements(x) => 0;", []);
4909 ParserTestCase.parse4("parseCompilationUnit", "import(x) => 0;", []); 4907 ParserTestCase.parse4("parseCompilationUnit", "import(x) => 0;", []);
4910 ParserTestCase.parse4("parseCompilationUnit", "library(x) => 0;", []); 4908 ParserTestCase.parse4("parseCompilationUnit", "library(x) => 0;", []);
4911 ParserTestCase.parse4("parseCompilationUnit", "operator(x) => 0;", []); 4909 ParserTestCase.parse4("parseCompilationUnit", "operator(x) => 0;", []);
4912 ParserTestCase.parse4("parseCompilationUnit", "part(x) => 0;", []); 4910 ParserTestCase.parse4("parseCompilationUnit", "part(x) => 0;", []);
4913 ParserTestCase.parse4("parseCompilationUnit", "set(x) => 0;", []); 4911 ParserTestCase.parse4("parseCompilationUnit", "set(x) => 0;", []);
4914 ParserTestCase.parse4("parseCompilationUnit", "static(x) => 0;", []); 4912 ParserTestCase.parse4("parseCompilationUnit", "static(x) => 0;", []);
4915 ParserTestCase.parse4("parseCompilationUnit", "typedef(x) => 0;", []); 4913 ParserTestCase.parse4("parseCompilationUnit", "typedef(x) => 0;", []);
4916 } 4914 }
4917 4915
4918 void test_parseCompilationUnit_directives_multiple() { 4916 void test_parseCompilationUnit_directives_multiple() {
4919 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;\npart 'a.dart';", []); 4917 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;\npart 'a.dart';", []);
4920 JUnitTestCase.assertNull(unit.scriptTag); 4918 expect(unit.scriptTag, isNull);
4921 EngineTestCase.assertSizeOfList(2, unit.directives); 4919 EngineTestCase.assertSizeOfList(2, unit.directives);
4922 EngineTestCase.assertSizeOfList(0, unit.declarations); 4920 EngineTestCase.assertSizeOfList(0, unit.declarations);
4923 } 4921 }
4924 4922
4925 void test_parseCompilationUnit_directives_single() { 4923 void test_parseCompilationUnit_directives_single() {
4926 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;", []); 4924 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "librar y l;", []);
4927 JUnitTestCase.assertNull(unit.scriptTag); 4925 expect(unit.scriptTag, isNull);
4928 EngineTestCase.assertSizeOfList(1, unit.directives); 4926 EngineTestCase.assertSizeOfList(1, unit.directives);
4929 EngineTestCase.assertSizeOfList(0, unit.declarations); 4927 EngineTestCase.assertSizeOfList(0, unit.declarations);
4930 } 4928 }
4931 4929
4932 void test_parseCompilationUnit_empty() { 4930 void test_parseCompilationUnit_empty() {
4933 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "", []) ; 4931 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "", []) ;
4934 JUnitTestCase.assertNull(unit.scriptTag); 4932 expect(unit.scriptTag, isNull);
4935 EngineTestCase.assertSizeOfList(0, unit.directives); 4933 EngineTestCase.assertSizeOfList(0, unit.directives);
4936 EngineTestCase.assertSizeOfList(0, unit.declarations); 4934 EngineTestCase.assertSizeOfList(0, unit.declarations);
4937 } 4935 }
4938 4936
4939 void test_parseCompilationUnit_exportAsPrefix() { 4937 void test_parseCompilationUnit_exportAsPrefix() {
4940 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export .A _export = new export.A();", []); 4938 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export .A _export = new export.A();", []);
4941 JUnitTestCase.assertNull(unit.scriptTag); 4939 expect(unit.scriptTag, isNull);
4942 EngineTestCase.assertSizeOfList(0, unit.directives); 4940 EngineTestCase.assertSizeOfList(0, unit.directives);
4943 EngineTestCase.assertSizeOfList(1, unit.declarations); 4941 EngineTestCase.assertSizeOfList(1, unit.declarations);
4944 } 4942 }
4945 4943
4946 void test_parseCompilationUnit_exportAsPrefix_parameterized() { 4944 void test_parseCompilationUnit_exportAsPrefix_parameterized() {
4947 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export <dynamic> _export = new export.A();", []); 4945 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export <dynamic> _export = new export.A();", []);
4948 JUnitTestCase.assertNull(unit.scriptTag); 4946 expect(unit.scriptTag, isNull);
4949 EngineTestCase.assertSizeOfList(0, unit.directives); 4947 EngineTestCase.assertSizeOfList(0, unit.directives);
4950 EngineTestCase.assertSizeOfList(1, unit.declarations); 4948 EngineTestCase.assertSizeOfList(1, unit.declarations);
4951 } 4949 }
4952 4950
4953 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { 4951 void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
4954 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();", []);
4955 JUnitTestCase.assertNull(unit.scriptTag); 4953 expect(unit.scriptTag, isNull);
4956 EngineTestCase.assertSizeOfList(0, unit.directives); 4954 EngineTestCase.assertSizeOfList(0, unit.directives);
4957 EngineTestCase.assertSizeOfList(1, unit.declarations); 4955 EngineTestCase.assertSizeOfList(1, unit.declarations);
4958 } 4956 }
4959 4957
4960 void test_parseCompilationUnit_script() { 4958 void test_parseCompilationUnit_script() {
4961 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "#! /bi n/dart", []); 4959 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "#! /bi n/dart", []);
4962 JUnitTestCase.assertNotNull(unit.scriptTag); 4960 expect(unit.scriptTag, isNotNull);
4963 EngineTestCase.assertSizeOfList(0, unit.directives); 4961 EngineTestCase.assertSizeOfList(0, unit.directives);
4964 EngineTestCase.assertSizeOfList(0, unit.declarations); 4962 EngineTestCase.assertSizeOfList(0, unit.declarations);
4965 } 4963 }
4966 4964
4967 void test_parseCompilationUnit_skipFunctionBody_withInterpolation() { 4965 void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
4968 ParserTestCase.parseFunctionBodies = false; 4966 ParserTestCase.parseFunctionBodies = false;
4969 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }", []); 4967 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }", []);
4970 JUnitTestCase.assertNull(unit.scriptTag); 4968 expect(unit.scriptTag, isNull);
4971 EngineTestCase.assertSizeOfList(1, unit.declarations); 4969 EngineTestCase.assertSizeOfList(1, unit.declarations);
4972 } 4970 }
4973 4971
4974 void test_parseCompilationUnit_topLevelDeclaration() { 4972 void test_parseCompilationUnit_topLevelDeclaration() {
4975 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "class A {}", []); 4973 CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "class A {}", []);
4976 JUnitTestCase.assertNull(unit.scriptTag); 4974 expect(unit.scriptTag, isNull);
4977 EngineTestCase.assertSizeOfList(0, unit.directives); 4975 EngineTestCase.assertSizeOfList(0, unit.directives);
4978 EngineTestCase.assertSizeOfList(1, unit.declarations); 4976 EngineTestCase.assertSizeOfList(1, unit.declarations);
4979 } 4977 }
4980 4978
4981 void test_parseCompilationUnit_typedefAsPrefix() { 4979 void test_parseCompilationUnit_typedefAsPrefix() {
4982 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();", []);
4983 JUnitTestCase.assertNull(unit.scriptTag); 4981 expect(unit.scriptTag, isNull);
4984 EngineTestCase.assertSizeOfList(0, unit.directives); 4982 EngineTestCase.assertSizeOfList(0, unit.directives);
4985 EngineTestCase.assertSizeOfList(1, unit.declarations); 4983 EngineTestCase.assertSizeOfList(1, unit.declarations);
4986 } 4984 }
4987 4985
4988 void test_parseCompilationUnitMember_abstractAsPrefix() { 4986 void test_parseCompilationUnitMember_abstractAsPrefix() {
4989 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();");
4990 JUnitTestCase.assertNotNull(declaration.semicolon); 4988 expect(declaration.semicolon, isNotNull);
4991 JUnitTestCase.assertNotNull(declaration.variables); 4989 expect(declaration.variables, isNotNull);
4992 } 4990 }
4993 4991
4994 void test_parseCompilationUnitMember_class() { 4992 void test_parseCompilationUnitMember_class() {
4995 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}"); 4993 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}");
4996 JUnitTestCase.assertEquals("A", declaration.name.name); 4994 expect(declaration.name.name, "A");
4997 EngineTestCase.assertSizeOfList(0, declaration.members); 4995 EngineTestCase.assertSizeOfList(0, declaration.members);
4998 } 4996 }
4999 4997
5000 void test_parseCompilationUnitMember_classTypeAlias() { 4998 void test_parseCompilationUnitMember_classTypeAlias() {
5001 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;");
5002 JUnitTestCase.assertEquals("A", alias.name.name); 5000 expect(alias.name.name, "A");
5003 JUnitTestCase.assertNotNull(alias.abstractKeyword); 5001 expect(alias.abstractKeyword, isNotNull);
5004 } 5002 }
5005 5003
5006 void test_parseCompilationUnitMember_constVariable() { 5004 void test_parseCompilationUnitMember_constVariable() {
5007 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;");
5008 JUnitTestCase.assertNotNull(declaration.semicolon); 5006 expect(declaration.semicolon, isNotNull);
5009 JUnitTestCase.assertNotNull(declaration.variables); 5007 expect(declaration.variables, isNotNull);
5010 } 5008 }
5011 5009
5012 void test_parseCompilationUnitMember_finalVariable() { 5010 void test_parseCompilationUnitMember_finalVariable() {
5013 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "final x = 0;"); 5011 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "final x = 0;");
5014 JUnitTestCase.assertNotNull(declaration.semicolon); 5012 expect(declaration.semicolon, isNotNull);
5015 JUnitTestCase.assertNotNull(declaration.variables); 5013 expect(declaration.variables, isNotNull);
5016 } 5014 }
5017 5015
5018 void test_parseCompilationUnitMember_function_external_noType() { 5016 void test_parseCompilationUnitMember_function_external_noType() {
5019 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external f();"); 5017 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external f();");
5020 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5018 expect(declaration.externalKeyword, isNotNull);
5021 JUnitTestCase.assertNotNull(declaration.functionExpression); 5019 expect(declaration.functionExpression, isNotNull);
5022 JUnitTestCase.assertNull(declaration.propertyKeyword); 5020 expect(declaration.propertyKeyword, isNull);
5023 } 5021 }
5024 5022
5025 void test_parseCompilationUnitMember_function_external_type() { 5023 void test_parseCompilationUnitMember_function_external_type() {
5026 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int f();"); 5024 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int f();");
5027 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5025 expect(declaration.externalKeyword, isNotNull);
5028 JUnitTestCase.assertNotNull(declaration.functionExpression); 5026 expect(declaration.functionExpression, isNotNull);
5029 JUnitTestCase.assertNull(declaration.propertyKeyword); 5027 expect(declaration.propertyKeyword, isNull);
5030 } 5028 }
5031 5029
5032 void test_parseCompilationUnitMember_function_noType() { 5030 void test_parseCompilationUnitMember_function_noType() {
5033 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "f() {}"); 5031 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "f() {}");
5034 JUnitTestCase.assertNotNull(declaration.functionExpression); 5032 expect(declaration.functionExpression, isNotNull);
5035 JUnitTestCase.assertNull(declaration.propertyKeyword); 5033 expect(declaration.propertyKeyword, isNull);
5036 } 5034 }
5037 5035
5038 void test_parseCompilationUnitMember_function_type() { 5036 void test_parseCompilationUnitMember_function_type() {
5039 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int f() {}"); 5037 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int f() {}");
5040 JUnitTestCase.assertNotNull(declaration.functionExpression); 5038 expect(declaration.functionExpression, isNotNull);
5041 JUnitTestCase.assertNull(declaration.propertyKeyword); 5039 expect(declaration.propertyKeyword, isNull);
5042 } 5040 }
5043 5041
5044 void test_parseCompilationUnitMember_function_void() { 5042 void test_parseCompilationUnitMember_function_void() {
5045 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void f() {}"); 5043 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void f() {}");
5046 JUnitTestCase.assertNotNull(declaration.returnType); 5044 expect(declaration.returnType, isNotNull);
5047 } 5045 }
5048 5046
5049 void test_parseCompilationUnitMember_getter_external_noType() { 5047 void test_parseCompilationUnitMember_getter_external_noType() {
5050 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external get p;"); 5048 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external get p;");
5051 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5049 expect(declaration.externalKeyword, isNotNull);
5052 JUnitTestCase.assertNotNull(declaration.functionExpression); 5050 expect(declaration.functionExpression, isNotNull);
5053 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5051 expect(declaration.propertyKeyword, isNotNull);
5054 } 5052 }
5055 5053
5056 void test_parseCompilationUnitMember_getter_external_type() { 5054 void test_parseCompilationUnitMember_getter_external_type() {
5057 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int get p;"); 5055 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int get p;");
5058 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5056 expect(declaration.externalKeyword, isNotNull);
5059 JUnitTestCase.assertNotNull(declaration.functionExpression); 5057 expect(declaration.functionExpression, isNotNull);
5060 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5058 expect(declaration.propertyKeyword, isNotNull);
5061 } 5059 }
5062 5060
5063 void test_parseCompilationUnitMember_getter_noType() { 5061 void test_parseCompilationUnitMember_getter_noType() {
5064 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "get p => 0;"); 5062 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "get p => 0;");
5065 JUnitTestCase.assertNotNull(declaration.functionExpression); 5063 expect(declaration.functionExpression, isNotNull);
5066 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5064 expect(declaration.propertyKeyword, isNotNull);
5067 } 5065 }
5068 5066
5069 void test_parseCompilationUnitMember_getter_type() { 5067 void test_parseCompilationUnitMember_getter_type() {
5070 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int get p => 0;"); 5068 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int get p => 0;");
5071 JUnitTestCase.assertNotNull(declaration.functionExpression); 5069 expect(declaration.functionExpression, isNotNull);
5072 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5070 expect(declaration.propertyKeyword, isNotNull);
5073 } 5071 }
5074 5072
5075 void test_parseCompilationUnitMember_setter_external_noType() { 5073 void test_parseCompilationUnitMember_setter_external_noType() {
5076 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external set p(v);"); 5074 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external set p(v);");
5077 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5075 expect(declaration.externalKeyword, isNotNull);
5078 JUnitTestCase.assertNotNull(declaration.functionExpression); 5076 expect(declaration.functionExpression, isNotNull);
5079 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5077 expect(declaration.propertyKeyword, isNotNull);
5080 } 5078 }
5081 5079
5082 void test_parseCompilationUnitMember_setter_external_type() { 5080 void test_parseCompilationUnitMember_setter_external_type() {
5083 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external void set p(int v);"); 5081 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external void set p(int v);");
5084 JUnitTestCase.assertNotNull(declaration.externalKeyword); 5082 expect(declaration.externalKeyword, isNotNull);
5085 JUnitTestCase.assertNotNull(declaration.functionExpression); 5083 expect(declaration.functionExpression, isNotNull);
5086 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5084 expect(declaration.propertyKeyword, isNotNull);
5087 } 5085 }
5088 5086
5089 void test_parseCompilationUnitMember_setter_noType() { 5087 void test_parseCompilationUnitMember_setter_noType() {
5090 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "set p(v) {}"); 5088 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "set p(v) {}");
5091 JUnitTestCase.assertNotNull(declaration.functionExpression); 5089 expect(declaration.functionExpression, isNotNull);
5092 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5090 expect(declaration.propertyKeyword, isNotNull);
5093 } 5091 }
5094 5092
5095 void test_parseCompilationUnitMember_setter_type() { 5093 void test_parseCompilationUnitMember_setter_type() {
5096 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void set p(int v) {}"); 5094 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void set p(int v) {}");
5097 JUnitTestCase.assertNotNull(declaration.functionExpression); 5095 expect(declaration.functionExpression, isNotNull);
5098 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 5096 expect(declaration.propertyKeyword, isNotNull);
5099 JUnitTestCase.assertNotNull(declaration.returnType); 5097 expect(declaration.returnType, isNotNull);
5100 } 5098 }
5101 5099
5102 void test_parseCompilationUnitMember_typeAlias_abstract() { 5100 void test_parseCompilationUnitMember_typeAlias_abstract() {
5103 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "abstract class C = S with M;"); 5101 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "abstract class C = S with M;");
5104 JUnitTestCase.assertNotNull(typeAlias.keyword); 5102 expect(typeAlias.keyword, isNotNull);
5105 JUnitTestCase.assertEquals("C", typeAlias.name.name); 5103 expect(typeAlias.name.name, "C");
5106 JUnitTestCase.assertNull(typeAlias.typeParameters); 5104 expect(typeAlias.typeParameters, isNull);
5107 JUnitTestCase.assertNotNull(typeAlias.equals); 5105 expect(typeAlias.equals, isNotNull);
5108 JUnitTestCase.assertNotNull(typeAlias.abstractKeyword); 5106 expect(typeAlias.abstractKeyword, isNotNull);
5109 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 5107 expect(typeAlias.superclass.name.name, "S");
5110 JUnitTestCase.assertNotNull(typeAlias.withClause); 5108 expect(typeAlias.withClause, isNotNull);
5111 JUnitTestCase.assertNull(typeAlias.implementsClause); 5109 expect(typeAlias.implementsClause, isNull);
5112 JUnitTestCase.assertNotNull(typeAlias.semicolon); 5110 expect(typeAlias.semicolon, isNotNull);
5113 } 5111 }
5114 5112
5115 void test_parseCompilationUnitMember_typeAlias_generic() { 5113 void test_parseCompilationUnitMember_typeAlias_generic() {
5116 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>;");
5117 JUnitTestCase.assertNotNull(typeAlias.keyword); 5115 expect(typeAlias.keyword, isNotNull);
5118 JUnitTestCase.assertEquals("C", typeAlias.name.name); 5116 expect(typeAlias.name.name, "C");
5119 EngineTestCase.assertSizeOfList(1, typeAlias.typeParameters.typeParameters); 5117 EngineTestCase.assertSizeOfList(1, typeAlias.typeParameters.typeParameters);
5120 JUnitTestCase.assertNotNull(typeAlias.equals); 5118 expect(typeAlias.equals, isNotNull);
5121 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 5119 expect(typeAlias.abstractKeyword, isNull);
5122 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 5120 expect(typeAlias.superclass.name.name, "S");
5123 JUnitTestCase.assertNotNull(typeAlias.withClause); 5121 expect(typeAlias.withClause, isNotNull);
5124 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 5122 expect(typeAlias.implementsClause, isNotNull);
5125 JUnitTestCase.assertNotNull(typeAlias.semicolon); 5123 expect(typeAlias.semicolon, isNotNull);
5126 } 5124 }
5127 5125
5128 void test_parseCompilationUnitMember_typeAlias_implements() { 5126 void test_parseCompilationUnitMember_typeAlias_implements() {
5129 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;");
5130 JUnitTestCase.assertNotNull(typeAlias.keyword); 5128 expect(typeAlias.keyword, isNotNull);
5131 JUnitTestCase.assertEquals("C", typeAlias.name.name); 5129 expect(typeAlias.name.name, "C");
5132 JUnitTestCase.assertNull(typeAlias.typeParameters); 5130 expect(typeAlias.typeParameters, isNull);
5133 JUnitTestCase.assertNotNull(typeAlias.equals); 5131 expect(typeAlias.equals, isNotNull);
5134 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 5132 expect(typeAlias.abstractKeyword, isNull);
5135 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 5133 expect(typeAlias.superclass.name.name, "S");
5136 JUnitTestCase.assertNotNull(typeAlias.withClause); 5134 expect(typeAlias.withClause, isNotNull);
5137 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 5135 expect(typeAlias.implementsClause, isNotNull);
5138 JUnitTestCase.assertNotNull(typeAlias.semicolon); 5136 expect(typeAlias.semicolon, isNotNull);
5139 } 5137 }
5140 5138
5141 void test_parseCompilationUnitMember_typeAlias_noImplements() { 5139 void test_parseCompilationUnitMember_typeAlias_noImplements() {
5142 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M;"); 5140 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M;");
5143 JUnitTestCase.assertNotNull(typeAlias.keyword); 5141 expect(typeAlias.keyword, isNotNull);
5144 JUnitTestCase.assertEquals("C", typeAlias.name.name); 5142 expect(typeAlias.name.name, "C");
5145 JUnitTestCase.assertNull(typeAlias.typeParameters); 5143 expect(typeAlias.typeParameters, isNull);
5146 JUnitTestCase.assertNotNull(typeAlias.equals); 5144 expect(typeAlias.equals, isNotNull);
5147 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 5145 expect(typeAlias.abstractKeyword, isNull);
5148 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 5146 expect(typeAlias.superclass.name.name, "S");
5149 JUnitTestCase.assertNotNull(typeAlias.withClause); 5147 expect(typeAlias.withClause, isNotNull);
5150 JUnitTestCase.assertNull(typeAlias.implementsClause); 5148 expect(typeAlias.implementsClause, isNull);
5151 JUnitTestCase.assertNotNull(typeAlias.semicolon); 5149 expect(typeAlias.semicolon, isNotNull);
5152 } 5150 }
5153 5151
5154 void test_parseCompilationUnitMember_typedef() { 5152 void test_parseCompilationUnitMember_typedef() {
5155 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();"); 5153 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();");
5156 JUnitTestCase.assertEquals("F", typeAlias.name.name); 5154 expect(typeAlias.name.name, "F");
5157 EngineTestCase.assertSizeOfList(0, typeAlias.parameters.parameters); 5155 EngineTestCase.assertSizeOfList(0, typeAlias.parameters.parameters);
5158 } 5156 }
5159 5157
5160 void test_parseCompilationUnitMember_variable() { 5158 void test_parseCompilationUnitMember_variable() {
5161 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;"); 5159 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;");
5162 JUnitTestCase.assertNotNull(declaration.semicolon); 5160 expect(declaration.semicolon, isNotNull);
5163 JUnitTestCase.assertNotNull(declaration.variables); 5161 expect(declaration.variables, isNotNull);
5164 } 5162 }
5165 5163
5166 void test_parseCompilationUnitMember_variableGet() { 5164 void test_parseCompilationUnitMember_variableGet() {
5167 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;"); 5165 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;");
5168 JUnitTestCase.assertNotNull(declaration.semicolon); 5166 expect(declaration.semicolon, isNotNull);
5169 JUnitTestCase.assertNotNull(declaration.variables); 5167 expect(declaration.variables, isNotNull);
5170 } 5168 }
5171 5169
5172 void test_parseCompilationUnitMember_variableSet() { 5170 void test_parseCompilationUnitMember_variableSet() {
5173 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String set = null;"); 5171 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String set = null;");
5174 JUnitTestCase.assertNotNull(declaration.semicolon); 5172 expect(declaration.semicolon, isNotNull);
5175 JUnitTestCase.assertNotNull(declaration.variables); 5173 expect(declaration.variables, isNotNull);
5176 } 5174 }
5177 5175
5178 void test_parseConditionalExpression() { 5176 void test_parseConditionalExpression() {
5179 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? y : z", []); 5177 ConditionalExpression expression = ParserTestCase.parse4("parseConditionalEx pression", "x ? y : z", []);
5180 JUnitTestCase.assertNotNull(expression.condition); 5178 expect(expression.condition, isNotNull);
5181 JUnitTestCase.assertNotNull(expression.question); 5179 expect(expression.question, isNotNull);
5182 JUnitTestCase.assertNotNull(expression.thenExpression); 5180 expect(expression.thenExpression, isNotNull);
5183 JUnitTestCase.assertNotNull(expression.colon); 5181 expect(expression.colon, isNotNull);
5184 JUnitTestCase.assertNotNull(expression.elseExpression); 5182 expect(expression.elseExpression, isNotNull);
5185 } 5183 }
5186 5184
5187 void test_parseConstExpression_instanceCreation() { 5185 void test_parseConstExpression_instanceCreation() {
5188 InstanceCreationExpression expression = ParserTestCase.parse4("parseConstExp ression", "const A()", []); 5186 InstanceCreationExpression expression = ParserTestCase.parse4("parseConstExp ression", "const A()", []);
5189 JUnitTestCase.assertNotNull(expression.keyword); 5187 expect(expression.keyword, isNotNull);
5190 ConstructorName name = expression.constructorName; 5188 ConstructorName name = expression.constructorName;
5191 JUnitTestCase.assertNotNull(name); 5189 expect(name, isNotNull);
5192 JUnitTestCase.assertNotNull(name.type); 5190 expect(name.type, isNotNull);
5193 JUnitTestCase.assertNull(name.period); 5191 expect(name.period, isNull);
5194 JUnitTestCase.assertNull(name.name); 5192 expect(name.name, isNull);
5195 JUnitTestCase.assertNotNull(expression.argumentList); 5193 expect(expression.argumentList, isNotNull);
5196 } 5194 }
5197 5195
5198 void test_parseConstExpression_listLiteral_typed() { 5196 void test_parseConstExpression_listLiteral_typed() {
5199 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const < A> []", []); 5197 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const < A> []", []);
5200 JUnitTestCase.assertNotNull(literal.constKeyword); 5198 expect(literal.constKeyword, isNotNull);
5201 JUnitTestCase.assertNotNull(literal.typeArguments); 5199 expect(literal.typeArguments, isNotNull);
5202 JUnitTestCase.assertNotNull(literal.leftBracket); 5200 expect(literal.leftBracket, isNotNull);
5203 EngineTestCase.assertSizeOfList(0, literal.elements); 5201 EngineTestCase.assertSizeOfList(0, literal.elements);
5204 JUnitTestCase.assertNotNull(literal.rightBracket); 5202 expect(literal.rightBracket, isNotNull);
5205 } 5203 }
5206 5204
5207 void test_parseConstExpression_listLiteral_untyped() { 5205 void test_parseConstExpression_listLiteral_untyped() {
5208 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const [ ]", []); 5206 ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const [ ]", []);
5209 JUnitTestCase.assertNotNull(literal.constKeyword); 5207 expect(literal.constKeyword, isNotNull);
5210 JUnitTestCase.assertNull(literal.typeArguments); 5208 expect(literal.typeArguments, isNull);
5211 JUnitTestCase.assertNotNull(literal.leftBracket); 5209 expect(literal.leftBracket, isNotNull);
5212 EngineTestCase.assertSizeOfList(0, literal.elements); 5210 EngineTestCase.assertSizeOfList(0, literal.elements);
5213 JUnitTestCase.assertNotNull(literal.rightBracket); 5211 expect(literal.rightBracket, isNotNull);
5214 } 5212 }
5215 5213
5216 void test_parseConstExpression_mapLiteral_typed() { 5214 void test_parseConstExpression_mapLiteral_typed() {
5217 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A , B> {}", []); 5215 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A , B> {}", []);
5218 JUnitTestCase.assertNotNull(literal.leftBracket); 5216 expect(literal.leftBracket, isNotNull);
5219 EngineTestCase.assertSizeOfList(0, literal.entries); 5217 EngineTestCase.assertSizeOfList(0, literal.entries);
5220 JUnitTestCase.assertNotNull(literal.rightBracket); 5218 expect(literal.rightBracket, isNotNull);
5221 JUnitTestCase.assertNotNull(literal.typeArguments); 5219 expect(literal.typeArguments, isNotNull);
5222 } 5220 }
5223 5221
5224 void test_parseConstExpression_mapLiteral_untyped() { 5222 void test_parseConstExpression_mapLiteral_untyped() {
5225 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {} ", []); 5223 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {} ", []);
5226 JUnitTestCase.assertNotNull(literal.leftBracket); 5224 expect(literal.leftBracket, isNotNull);
5227 EngineTestCase.assertSizeOfList(0, literal.entries); 5225 EngineTestCase.assertSizeOfList(0, literal.entries);
5228 JUnitTestCase.assertNotNull(literal.rightBracket); 5226 expect(literal.rightBracket, isNotNull);
5229 JUnitTestCase.assertNull(literal.typeArguments); 5227 expect(literal.typeArguments, isNull);
5230 } 5228 }
5231 5229
5232 void test_parseConstructor() { 5230 void test_parseConstructor() {
5233 // TODO(brianwilkerson) Implement tests for this method. 5231 // TODO(brianwilkerson) Implement tests for this method.
5234 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class , 5232 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class ,
5235 // Token.class, Token.class, SimpleIdentifier.class, Token.class, 5233 // Token.class, Token.class, SimpleIdentifier.class, Token.class,
5236 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] { emptyCommentAndMetadata(), 5234 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] { emptyCommentAndMetadata(),
5237 // null, null, null, null, null, null}, ""); 5235 // null, null, null, null, null, null}, "");
5238 } 5236 }
5239 5237
5240 void test_parseConstructor_with_pseudo_function_literal() { 5238 void test_parseConstructor_with_pseudo_function_literal() {
5241 // "(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.
5242 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object> ["C"], "C() : a = (b) {}"); 5240 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object> ["C"], "C() : a = (b) {}");
5243 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons tructorDeclaration, classMember); 5241 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons tructorDeclaration, classMember);
5244 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; 5242 ConstructorDeclaration constructor = classMember as ConstructorDeclaration;
5245 NodeList<ConstructorInitializer> initializers = constructor.initializers; 5243 NodeList<ConstructorInitializer> initializers = constructor.initializers;
5246 EngineTestCase.assertSizeOfList(1, initializers); 5244 EngineTestCase.assertSizeOfList(1, initializers);
5247 ConstructorInitializer initializer = initializers[0]; 5245 ConstructorInitializer initializer = initializers[0];
5248 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorFieldInitializer, ConstructorFieldInitializer, initializer); 5246 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorFieldInitializer, ConstructorFieldInitializer, initializer);
5249 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);
5250 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, constructor.body); 5248 EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunc tionBody, constructor.body);
5251 } 5249 }
5252 5250
5253 void test_parseConstructorFieldInitializer_qualified() { 5251 void test_parseConstructorFieldInitializer_qualified() {
5254 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "this.a = b", []); 5252 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "this.a = b", []);
5255 JUnitTestCase.assertNotNull(invocation.equals); 5253 expect(invocation.equals, isNotNull);
5256 JUnitTestCase.assertNotNull(invocation.expression); 5254 expect(invocation.expression, isNotNull);
5257 JUnitTestCase.assertNotNull(invocation.fieldName); 5255 expect(invocation.fieldName, isNotNull);
5258 JUnitTestCase.assertNotNull(invocation.keyword); 5256 expect(invocation.keyword, isNotNull);
5259 JUnitTestCase.assertNotNull(invocation.period); 5257 expect(invocation.period, isNotNull);
5260 } 5258 }
5261 5259
5262 void test_parseConstructorFieldInitializer_unqualified() { 5260 void test_parseConstructorFieldInitializer_unqualified() {
5263 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "a = b", []); 5261 ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstru ctorFieldInitializer", "a = b", []);
5264 JUnitTestCase.assertNotNull(invocation.equals); 5262 expect(invocation.equals, isNotNull);
5265 JUnitTestCase.assertNotNull(invocation.expression); 5263 expect(invocation.expression, isNotNull);
5266 JUnitTestCase.assertNotNull(invocation.fieldName); 5264 expect(invocation.fieldName, isNotNull);
5267 JUnitTestCase.assertNull(invocation.keyword); 5265 expect(invocation.keyword, isNull);
5268 JUnitTestCase.assertNull(invocation.period); 5266 expect(invocation.period, isNull);
5269 } 5267 }
5270 5268
5271 void test_parseConstructorName_named_noPrefix() { 5269 void test_parseConstructorName_named_noPrefix() {
5272 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A.n;", []); 5270 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A.n;", []);
5273 JUnitTestCase.assertNotNull(name.type); 5271 expect(name.type, isNotNull);
5274 JUnitTestCase.assertNull(name.period); 5272 expect(name.period, isNull);
5275 JUnitTestCase.assertNull(name.name); 5273 expect(name.name, isNull);
5276 } 5274 }
5277 5275
5278 void test_parseConstructorName_named_prefixed() { 5276 void test_parseConstructorName_named_prefixed() {
5279 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "p.A.n; ", []); 5277 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "p.A.n; ", []);
5280 JUnitTestCase.assertNotNull(name.type); 5278 expect(name.type, isNotNull);
5281 JUnitTestCase.assertNotNull(name.period); 5279 expect(name.period, isNotNull);
5282 JUnitTestCase.assertNotNull(name.name); 5280 expect(name.name, isNotNull);
5283 } 5281 }
5284 5282
5285 void test_parseConstructorName_unnamed_noPrefix() { 5283 void test_parseConstructorName_unnamed_noPrefix() {
5286 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A;", [ ]); 5284 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A;", [ ]);
5287 JUnitTestCase.assertNotNull(name.type); 5285 expect(name.type, isNotNull);
5288 JUnitTestCase.assertNull(name.period); 5286 expect(name.period, isNull);
5289 JUnitTestCase.assertNull(name.name); 5287 expect(name.name, isNull);
5290 } 5288 }
5291 5289
5292 void test_parseConstructorName_unnamed_prefixed() { 5290 void test_parseConstructorName_unnamed_prefixed() {
5293 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "p.A;", []); 5291 ConstructorName name = ParserTestCase.parse4("parseConstructorName", "p.A;", []);
5294 JUnitTestCase.assertNotNull(name.type); 5292 expect(name.type, isNotNull);
5295 JUnitTestCase.assertNull(name.period); 5293 expect(name.period, isNull);
5296 JUnitTestCase.assertNull(name.name); 5294 expect(name.name, isNull);
5297 } 5295 }
5298 5296
5299 void test_parseContinueStatement_label() { 5297 void test_parseContinueStatement_label() {
5300 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue foo;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 5298 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue foo;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
5301 JUnitTestCase.assertNotNull(statement.keyword); 5299 expect(statement.keyword, isNotNull);
5302 JUnitTestCase.assertNotNull(statement.label); 5300 expect(statement.label, isNotNull);
5303 JUnitTestCase.assertNotNull(statement.semicolon); 5301 expect(statement.semicolon, isNotNull);
5304 } 5302 }
5305 5303
5306 void test_parseContinueStatement_noLabel() { 5304 void test_parseContinueStatement_noLabel() {
5307 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 5305 ContinueStatement statement = ParserTestCase.parse4("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
5308 JUnitTestCase.assertNotNull(statement.keyword); 5306 expect(statement.keyword, isNotNull);
5309 JUnitTestCase.assertNull(statement.label); 5307 expect(statement.label, isNull);
5310 JUnitTestCase.assertNotNull(statement.semicolon); 5308 expect(statement.semicolon, isNotNull);
5311 } 5309 }
5312 5310
5313 void test_parseDirective_export() { 5311 void test_parseDirective_export() {
5314 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';"); 5312 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
5315 JUnitTestCase.assertNotNull(directive.keyword); 5313 expect(directive.keyword, isNotNull);
5316 JUnitTestCase.assertNotNull(directive.uri); 5314 expect(directive.uri, isNotNull);
5317 EngineTestCase.assertSizeOfList(0, directive.combinators); 5315 EngineTestCase.assertSizeOfList(0, directive.combinators);
5318 JUnitTestCase.assertNotNull(directive.semicolon); 5316 expect(directive.semicolon, isNotNull);
5319 } 5317 }
5320 5318
5321 void test_parseDirective_import() { 5319 void test_parseDirective_import() {
5322 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';"); 5320 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
5323 JUnitTestCase.assertNotNull(directive.keyword); 5321 expect(directive.keyword, isNotNull);
5324 JUnitTestCase.assertNotNull(directive.uri); 5322 expect(directive.uri, isNotNull);
5325 JUnitTestCase.assertNull(directive.asToken); 5323 expect(directive.asToken, isNull);
5326 JUnitTestCase.assertNull(directive.prefix); 5324 expect(directive.prefix, isNull);
5327 EngineTestCase.assertSizeOfList(0, directive.combinators); 5325 EngineTestCase.assertSizeOfList(0, directive.combinators);
5328 JUnitTestCase.assertNotNull(directive.semicolon); 5326 expect(directive.semicolon, isNotNull);
5329 } 5327 }
5330 5328
5331 void test_parseDirective_library() { 5329 void test_parseDirective_library() {
5332 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;"); 5330 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;");
5333 JUnitTestCase.assertNotNull(directive.libraryToken); 5331 expect(directive.libraryToken, isNotNull);
5334 JUnitTestCase.assertNotNull(directive.name); 5332 expect(directive.name, isNotNull);
5335 JUnitTestCase.assertNotNull(directive.semicolon); 5333 expect(directive.semicolon, isNotNull);
5336 } 5334 }
5337 5335
5338 void test_parseDirective_part() { 5336 void test_parseDirective_part() {
5339 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';");
5340 JUnitTestCase.assertNotNull(directive.partToken); 5338 expect(directive.partToken, isNotNull);
5341 JUnitTestCase.assertNotNull(directive.uri); 5339 expect(directive.uri, isNotNull);
5342 JUnitTestCase.assertNotNull(directive.semicolon); 5340 expect(directive.semicolon, isNotNull);
5343 } 5341 }
5344 5342
5345 void test_parseDirective_partOf() { 5343 void test_parseDirective_partOf() {
5346 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;"); 5344 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;");
5347 JUnitTestCase.assertNotNull(directive.partToken); 5345 expect(directive.partToken, isNotNull);
5348 JUnitTestCase.assertNotNull(directive.ofToken); 5346 expect(directive.ofToken, isNotNull);
5349 JUnitTestCase.assertNotNull(directive.libraryName); 5347 expect(directive.libraryName, isNotNull);
5350 JUnitTestCase.assertNotNull(directive.semicolon); 5348 expect(directive.semicolon, isNotNull);
5351 } 5349 }
5352 5350
5353 void test_parseDirectives_complete() { 5351 void test_parseDirectives_complete() {
5354 CompilationUnit unit = _parseDirectives("#! /bin/dart\nlibrary l;\nclass A { }", []); 5352 CompilationUnit unit = _parseDirectives("#! /bin/dart\nlibrary l;\nclass A { }", []);
5355 JUnitTestCase.assertNotNull(unit.scriptTag); 5353 expect(unit.scriptTag, isNotNull);
5356 EngineTestCase.assertSizeOfList(1, unit.directives); 5354 EngineTestCase.assertSizeOfList(1, unit.directives);
5357 } 5355 }
5358 5356
5359 void test_parseDirectives_empty() { 5357 void test_parseDirectives_empty() {
5360 CompilationUnit unit = _parseDirectives("", []); 5358 CompilationUnit unit = _parseDirectives("", []);
5361 JUnitTestCase.assertNull(unit.scriptTag); 5359 expect(unit.scriptTag, isNull);
5362 EngineTestCase.assertSizeOfList(0, unit.directives); 5360 EngineTestCase.assertSizeOfList(0, unit.directives);
5363 } 5361 }
5364 5362
5365 void test_parseDirectives_mixed() { 5363 void test_parseDirectives_mixed() {
5366 CompilationUnit unit = _parseDirectives("library l; class A {} part 'foo.dar t';", []); 5364 CompilationUnit unit = _parseDirectives("library l; class A {} part 'foo.dar t';", []);
5367 JUnitTestCase.assertNull(unit.scriptTag); 5365 expect(unit.scriptTag, isNull);
5368 EngineTestCase.assertSizeOfList(1, unit.directives); 5366 EngineTestCase.assertSizeOfList(1, unit.directives);
5369 } 5367 }
5370 5368
5371 void test_parseDirectives_multiple() { 5369 void test_parseDirectives_multiple() {
5372 CompilationUnit unit = _parseDirectives("library l;\npart 'a.dart';", []); 5370 CompilationUnit unit = _parseDirectives("library l;\npart 'a.dart';", []);
5373 JUnitTestCase.assertNull(unit.scriptTag); 5371 expect(unit.scriptTag, isNull);
5374 EngineTestCase.assertSizeOfList(2, unit.directives); 5372 EngineTestCase.assertSizeOfList(2, unit.directives);
5375 } 5373 }
5376 5374
5377 void test_parseDirectives_script() { 5375 void test_parseDirectives_script() {
5378 CompilationUnit unit = _parseDirectives("#! /bin/dart", []); 5376 CompilationUnit unit = _parseDirectives("#! /bin/dart", []);
5379 JUnitTestCase.assertNotNull(unit.scriptTag); 5377 expect(unit.scriptTag, isNotNull);
5380 EngineTestCase.assertSizeOfList(0, unit.directives); 5378 EngineTestCase.assertSizeOfList(0, unit.directives);
5381 } 5379 }
5382 5380
5383 void test_parseDirectives_single() { 5381 void test_parseDirectives_single() {
5384 CompilationUnit unit = _parseDirectives("library l;", []); 5382 CompilationUnit unit = _parseDirectives("library l;", []);
5385 JUnitTestCase.assertNull(unit.scriptTag); 5383 expect(unit.scriptTag, isNull);
5386 EngineTestCase.assertSizeOfList(1, unit.directives); 5384 EngineTestCase.assertSizeOfList(1, unit.directives);
5387 } 5385 }
5388 5386
5389 void test_parseDirectives_topLevelDeclaration() { 5387 void test_parseDirectives_topLevelDeclaration() {
5390 CompilationUnit unit = _parseDirectives("class A {}", []); 5388 CompilationUnit unit = _parseDirectives("class A {}", []);
5391 JUnitTestCase.assertNull(unit.scriptTag); 5389 expect(unit.scriptTag, isNull);
5392 EngineTestCase.assertSizeOfList(0, unit.directives); 5390 EngineTestCase.assertSizeOfList(0, unit.directives);
5393 } 5391 }
5394 5392
5395 void test_parseDocumentationComment_block() { 5393 void test_parseDocumentationComment_block() {
5396 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** */ class", []); 5394 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** */ class", []);
5397 JUnitTestCase.assertFalse(comment.isBlock); 5395 expect(comment.isBlock, isFalse);
5398 JUnitTestCase.assertTrue(comment.isDocumentation); 5396 expect(comment.isDocumentation, isTrue);
5399 JUnitTestCase.assertFalse(comment.isEndOfLine); 5397 expect(comment.isEndOfLine, isFalse);
5400 } 5398 }
5401 5399
5402 void test_parseDocumentationComment_block_withReference() { 5400 void test_parseDocumentationComment_block_withReference() {
5403 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** [a ] */ class", []); 5401 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** [a ] */ class", []);
5404 JUnitTestCase.assertFalse(comment.isBlock); 5402 expect(comment.isBlock, isFalse);
5405 JUnitTestCase.assertTrue(comment.isDocumentation); 5403 expect(comment.isDocumentation, isTrue);
5406 JUnitTestCase.assertFalse(comment.isEndOfLine); 5404 expect(comment.isEndOfLine, isFalse);
5407 NodeList<CommentReference> references = comment.references; 5405 NodeList<CommentReference> references = comment.references;
5408 EngineTestCase.assertSizeOfList(1, references); 5406 EngineTestCase.assertSizeOfList(1, references);
5409 CommentReference reference = references[0]; 5407 CommentReference reference = references[0];
5410 JUnitTestCase.assertNotNull(reference); 5408 expect(reference, isNotNull);
5411 JUnitTestCase.assertEquals(5, reference.offset); 5409 expect(reference.offset, 5);
5412 } 5410 }
5413 5411
5414 void test_parseDocumentationComment_endOfLine() { 5412 void test_parseDocumentationComment_endOfLine() {
5415 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/// \n /// \n class", []); 5413 Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/// \n /// \n class", []);
5416 JUnitTestCase.assertFalse(comment.isBlock); 5414 expect(comment.isBlock, isFalse);
5417 JUnitTestCase.assertTrue(comment.isDocumentation); 5415 expect(comment.isDocumentation, isTrue);
5418 JUnitTestCase.assertFalse(comment.isEndOfLine); 5416 expect(comment.isEndOfLine, isFalse);
5419 } 5417 }
5420 5418
5421 void test_parseDoStatement() { 5419 void test_parseDoStatement() {
5422 DoStatement statement = ParserTestCase.parse4("parseDoStatement", "do {} whi le (x);", []); 5420 DoStatement statement = ParserTestCase.parse4("parseDoStatement", "do {} whi le (x);", []);
5423 JUnitTestCase.assertNotNull(statement.doKeyword); 5421 expect(statement.doKeyword, isNotNull);
5424 JUnitTestCase.assertNotNull(statement.body); 5422 expect(statement.body, isNotNull);
5425 JUnitTestCase.assertNotNull(statement.whileKeyword); 5423 expect(statement.whileKeyword, isNotNull);
5426 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5424 expect(statement.leftParenthesis, isNotNull);
5427 JUnitTestCase.assertNotNull(statement.condition); 5425 expect(statement.condition, isNotNull);
5428 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5426 expect(statement.rightParenthesis, isNotNull);
5429 JUnitTestCase.assertNotNull(statement.semicolon); 5427 expect(statement.semicolon, isNotNull);
5430 } 5428 }
5431 5429
5432 void test_parseEmptyStatement() { 5430 void test_parseEmptyStatement() {
5433 EmptyStatement statement = ParserTestCase.parse4("parseEmptyStatement", ";", []); 5431 EmptyStatement statement = ParserTestCase.parse4("parseEmptyStatement", ";", []);
5434 JUnitTestCase.assertNotNull(statement.semicolon); 5432 expect(statement.semicolon, isNotNull);
5435 } 5433 }
5436 5434
5437 void test_parseEnumDeclaration_one() { 5435 void test_parseEnumDeclaration_one() {
5438 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE}"); 5436 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE}");
5439 JUnitTestCase.assertNull(declaration.documentationComment); 5437 expect(declaration.documentationComment, isNull);
5440 JUnitTestCase.assertNotNull(declaration.keyword); 5438 expect(declaration.keyword, isNotNull);
5441 JUnitTestCase.assertNotNull(declaration.leftBracket); 5439 expect(declaration.leftBracket, isNotNull);
5442 JUnitTestCase.assertNotNull(declaration.name); 5440 expect(declaration.name, isNotNull);
5443 EngineTestCase.assertSizeOfList(1, declaration.constants); 5441 EngineTestCase.assertSizeOfList(1, declaration.constants);
5444 JUnitTestCase.assertNotNull(declaration.rightBracket); 5442 expect(declaration.rightBracket, isNotNull);
5445 } 5443 }
5446 5444
5447 void test_parseEnumDeclaration_trailingComma() { 5445 void test_parseEnumDeclaration_trailingComma() {
5448 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE,}"); 5446 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE,}");
5449 JUnitTestCase.assertNull(declaration.documentationComment); 5447 expect(declaration.documentationComment, isNull);
5450 JUnitTestCase.assertNotNull(declaration.keyword); 5448 expect(declaration.keyword, isNotNull);
5451 JUnitTestCase.assertNotNull(declaration.leftBracket); 5449 expect(declaration.leftBracket, isNotNull);
5452 JUnitTestCase.assertNotNull(declaration.name); 5450 expect(declaration.name, isNotNull);
5453 EngineTestCase.assertSizeOfList(1, declaration.constants); 5451 EngineTestCase.assertSizeOfList(1, declaration.constants);
5454 JUnitTestCase.assertNotNull(declaration.rightBracket); 5452 expect(declaration.rightBracket, isNotNull);
5455 } 5453 }
5456 5454
5457 void test_parseEnumDeclaration_two() { 5455 void test_parseEnumDeclaration_two() {
5458 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE, TWO}"); 5456 EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", < Object> [emptyCommentAndMetadata()], "enum E {ONE, TWO}");
5459 JUnitTestCase.assertNull(declaration.documentationComment); 5457 expect(declaration.documentationComment, isNull);
5460 JUnitTestCase.assertNotNull(declaration.keyword); 5458 expect(declaration.keyword, isNotNull);
5461 JUnitTestCase.assertNotNull(declaration.leftBracket); 5459 expect(declaration.leftBracket, isNotNull);
5462 JUnitTestCase.assertNotNull(declaration.name); 5460 expect(declaration.name, isNotNull);
5463 EngineTestCase.assertSizeOfList(2, declaration.constants); 5461 EngineTestCase.assertSizeOfList(2, declaration.constants);
5464 JUnitTestCase.assertNotNull(declaration.rightBracket); 5462 expect(declaration.rightBracket, isNotNull);
5465 } 5463 }
5466 5464
5467 void test_parseEqualityExpression_normal() { 5465 void test_parseEqualityExpression_normal() {
5468 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "x == y", []); 5466 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "x == y", []);
5469 JUnitTestCase.assertNotNull(expression.leftOperand); 5467 expect(expression.leftOperand, isNotNull);
5470 JUnitTestCase.assertNotNull(expression.operator); 5468 expect(expression.operator, isNotNull);
5471 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 5469 expect(expression.operator.type, TokenType.EQ_EQ);
5472 JUnitTestCase.assertNotNull(expression.rightOperand); 5470 expect(expression.rightOperand, isNotNull);
5473 } 5471 }
5474 5472
5475 void test_parseEqualityExpression_super() { 5473 void test_parseEqualityExpression_super() {
5476 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "super == y", []); 5474 BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression ", "super == y", []);
5477 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 5475 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
5478 JUnitTestCase.assertNotNull(expression.operator); 5476 expect(expression.operator, isNotNull);
5479 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 5477 expect(expression.operator.type, TokenType.EQ_EQ);
5480 JUnitTestCase.assertNotNull(expression.rightOperand); 5478 expect(expression.rightOperand, isNotNull);
5481 } 5479 }
5482 5480
5483 void test_parseExportDirective_hide() { 5481 void test_parseExportDirective_hide() {
5484 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;");
5485 JUnitTestCase.assertNotNull(directive.keyword); 5483 expect(directive.keyword, isNotNull);
5486 JUnitTestCase.assertNotNull(directive.uri); 5484 expect(directive.uri, isNotNull);
5487 EngineTestCase.assertSizeOfList(1, directive.combinators); 5485 EngineTestCase.assertSizeOfList(1, directive.combinators);
5488 JUnitTestCase.assertNotNull(directive.semicolon); 5486 expect(directive.semicolon, isNotNull);
5489 } 5487 }
5490 5488
5491 void test_parseExportDirective_hide_show() { 5489 void test_parseExportDirective_hide_show() {
5492 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;");
5493 JUnitTestCase.assertNotNull(directive.keyword); 5491 expect(directive.keyword, isNotNull);
5494 JUnitTestCase.assertNotNull(directive.uri); 5492 expect(directive.uri, isNotNull);
5495 EngineTestCase.assertSizeOfList(2, directive.combinators); 5493 EngineTestCase.assertSizeOfList(2, directive.combinators);
5496 JUnitTestCase.assertNotNull(directive.semicolon); 5494 expect(directive.semicolon, isNotNull);
5497 } 5495 }
5498 5496
5499 void test_parseExportDirective_noCombinator() { 5497 void test_parseExportDirective_noCombinator() {
5500 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';");
5501 JUnitTestCase.assertNotNull(directive.keyword); 5499 expect(directive.keyword, isNotNull);
5502 JUnitTestCase.assertNotNull(directive.uri); 5500 expect(directive.uri, isNotNull);
5503 EngineTestCase.assertSizeOfList(0, directive.combinators); 5501 EngineTestCase.assertSizeOfList(0, directive.combinators);
5504 JUnitTestCase.assertNotNull(directive.semicolon); 5502 expect(directive.semicolon, isNotNull);
5505 } 5503 }
5506 5504
5507 void test_parseExportDirective_show() { 5505 void test_parseExportDirective_show() {
5508 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;");
5509 JUnitTestCase.assertNotNull(directive.keyword); 5507 expect(directive.keyword, isNotNull);
5510 JUnitTestCase.assertNotNull(directive.uri); 5508 expect(directive.uri, isNotNull);
5511 EngineTestCase.assertSizeOfList(1, directive.combinators); 5509 EngineTestCase.assertSizeOfList(1, directive.combinators);
5512 JUnitTestCase.assertNotNull(directive.semicolon); 5510 expect(directive.semicolon, isNotNull);
5513 } 5511 }
5514 5512
5515 void test_parseExportDirective_show_hide() { 5513 void test_parseExportDirective_show_hide() {
5516 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;");
5517 JUnitTestCase.assertNotNull(directive.keyword); 5515 expect(directive.keyword, isNotNull);
5518 JUnitTestCase.assertNotNull(directive.uri); 5516 expect(directive.uri, isNotNull);
5519 EngineTestCase.assertSizeOfList(2, directive.combinators); 5517 EngineTestCase.assertSizeOfList(2, directive.combinators);
5520 JUnitTestCase.assertNotNull(directive.semicolon); 5518 expect(directive.semicolon, isNotNull);
5521 } 5519 }
5522 5520
5523 void test_parseExpression_assign() { 5521 void test_parseExpression_assign() {
5524 // TODO(brianwilkerson) Implement more tests for this method. 5522 // TODO(brianwilkerson) Implement more tests for this method.
5525 AssignmentExpression expression = ParserTestCase.parse4("parseExpression", " x = y", []); 5523 AssignmentExpression expression = ParserTestCase.parse4("parseExpression", " x = y", []);
5526 JUnitTestCase.assertNotNull(expression.leftHandSide); 5524 expect(expression.leftHandSide, isNotNull);
5527 JUnitTestCase.assertNotNull(expression.operator); 5525 expect(expression.operator, isNotNull);
5528 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type); 5526 expect(expression.operator.type, TokenType.EQ);
5529 JUnitTestCase.assertNotNull(expression.rightHandSide); 5527 expect(expression.rightHandSide, isNotNull);
5530 } 5528 }
5531 5529
5532 void test_parseExpression_comparison() { 5530 void test_parseExpression_comparison() {
5533 BinaryExpression expression = ParserTestCase.parse4("parseExpression", "--a. b == c", []); 5531 BinaryExpression expression = ParserTestCase.parse4("parseExpression", "--a. b == c", []);
5534 JUnitTestCase.assertNotNull(expression.leftOperand); 5532 expect(expression.leftOperand, isNotNull);
5535 JUnitTestCase.assertNotNull(expression.operator); 5533 expect(expression.operator, isNotNull);
5536 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 5534 expect(expression.operator.type, TokenType.EQ_EQ);
5537 JUnitTestCase.assertNotNull(expression.rightOperand); 5535 expect(expression.rightOperand, isNotNull);
5538 } 5536 }
5539 5537
5540 void test_parseExpression_function_async() { 5538 void test_parseExpression_function_async() {
5541 FunctionExpression expression = ParserTestCase.parseExpression("() async {}" , []); 5539 FunctionExpression expression = ParserTestCase.parseExpression("() async {}" , []);
5542 JUnitTestCase.assertNotNull(expression.body); 5540 expect(expression.body, isNotNull);
5543 JUnitTestCase.assertTrue(expression.body.isAsynchronous); 5541 expect(expression.body.isAsynchronous, isTrue);
5544 JUnitTestCase.assertFalse(expression.body.isGenerator); 5542 expect(expression.body.isGenerator, isFalse);
5545 JUnitTestCase.assertNotNull(expression.parameters); 5543 expect(expression.parameters, isNotNull);
5546 } 5544 }
5547 5545
5548 void test_parseExpression_function_asyncStar() { 5546 void test_parseExpression_function_asyncStar() {
5549 FunctionExpression expression = ParserTestCase.parseExpression("() async* {} ", []); 5547 FunctionExpression expression = ParserTestCase.parseExpression("() async* {} ", []);
5550 JUnitTestCase.assertNotNull(expression.body); 5548 expect(expression.body, isNotNull);
5551 JUnitTestCase.assertTrue(expression.body.isAsynchronous); 5549 expect(expression.body.isAsynchronous, isTrue);
5552 JUnitTestCase.assertTrue(expression.body.isGenerator); 5550 expect(expression.body.isGenerator, isTrue);
5553 JUnitTestCase.assertNotNull(expression.parameters); 5551 expect(expression.parameters, isNotNull);
5554 } 5552 }
5555 5553
5556 void test_parseExpression_function_sync() { 5554 void test_parseExpression_function_sync() {
5557 FunctionExpression expression = ParserTestCase.parseExpression("() {}", []); 5555 FunctionExpression expression = ParserTestCase.parseExpression("() {}", []);
5558 JUnitTestCase.assertNotNull(expression.body); 5556 expect(expression.body, isNotNull);
5559 JUnitTestCase.assertFalse(expression.body.isAsynchronous); 5557 expect(expression.body.isAsynchronous, isFalse);
5560 JUnitTestCase.assertFalse(expression.body.isGenerator); 5558 expect(expression.body.isGenerator, isFalse);
5561 JUnitTestCase.assertNotNull(expression.parameters); 5559 expect(expression.parameters, isNotNull);
5562 } 5560 }
5563 5561
5564 void test_parseExpression_function_syncStar() { 5562 void test_parseExpression_function_syncStar() {
5565 FunctionExpression expression = ParserTestCase.parseExpression("() sync* {}" , []); 5563 FunctionExpression expression = ParserTestCase.parseExpression("() sync* {}" , []);
5566 JUnitTestCase.assertNotNull(expression.body); 5564 expect(expression.body, isNotNull);
5567 JUnitTestCase.assertFalse(expression.body.isAsynchronous); 5565 expect(expression.body.isAsynchronous, isFalse);
5568 JUnitTestCase.assertTrue(expression.body.isGenerator); 5566 expect(expression.body.isGenerator, isTrue);
5569 JUnitTestCase.assertNotNull(expression.parameters); 5567 expect(expression.parameters, isNotNull);
5570 } 5568 }
5571 5569
5572 void test_parseExpression_invokeFunctionExpression() { 5570 void test_parseExpression_invokeFunctionExpression() {
5573 FunctionExpressionInvocation invocation = ParserTestCase.parse4("parseExpres sion", "(a) {return a + a;} (3)", []); 5571 FunctionExpressionInvocation invocation = ParserTestCase.parse4("parseExpres sion", "(a) {return a + a;} (3)", []);
5574 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function); 5572 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function);
5575 FunctionExpression expression = invocation.function as FunctionExpression; 5573 FunctionExpression expression = invocation.function as FunctionExpression;
5576 JUnitTestCase.assertNotNull(expression.parameters); 5574 expect(expression.parameters, isNotNull);
5577 JUnitTestCase.assertNotNull(expression.body); 5575 expect(expression.body, isNotNull);
5578 ArgumentList list = invocation.argumentList; 5576 ArgumentList list = invocation.argumentList;
5579 JUnitTestCase.assertNotNull(list); 5577 expect(list, isNotNull);
5580 EngineTestCase.assertSizeOfList(1, list.arguments); 5578 EngineTestCase.assertSizeOfList(1, list.arguments);
5581 } 5579 }
5582 5580
5583 void test_parseExpression_superMethodInvocation() { 5581 void test_parseExpression_superMethodInvocation() {
5584 MethodInvocation invocation = ParserTestCase.parse4("parseExpression", "supe r.m()", []); 5582 MethodInvocation invocation = ParserTestCase.parse4("parseExpression", "supe r.m()", []);
5585 JUnitTestCase.assertNotNull(invocation.target); 5583 expect(invocation.target, isNotNull);
5586 JUnitTestCase.assertNotNull(invocation.methodName); 5584 expect(invocation.methodName, isNotNull);
5587 JUnitTestCase.assertNotNull(invocation.argumentList); 5585 expect(invocation.argumentList, isNotNull);
5588 } 5586 }
5589 5587
5590 void test_parseExpressionList_multiple() { 5588 void test_parseExpressionList_multiple() {
5591 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3", []); 5589 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2 , 3", []);
5592 EngineTestCase.assertSizeOfList(3, result); 5590 EngineTestCase.assertSizeOfList(3, result);
5593 } 5591 }
5594 5592
5595 void test_parseExpressionList_single() { 5593 void test_parseExpressionList_single() {
5596 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1", []); 5594 List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1", []);
5597 EngineTestCase.assertSizeOfList(1, result); 5595 EngineTestCase.assertSizeOfList(1, result);
5598 } 5596 }
5599 5597
5600 void test_parseExpressionWithoutCascade_assign() { 5598 void test_parseExpressionWithoutCascade_assign() {
5601 // TODO(brianwilkerson) Implement more tests for this method. 5599 // TODO(brianwilkerson) Implement more tests for this method.
5602 AssignmentExpression expression = ParserTestCase.parse4("parseExpressionWith outCascade", "x = y", []); 5600 AssignmentExpression expression = ParserTestCase.parse4("parseExpressionWith outCascade", "x = y", []);
5603 JUnitTestCase.assertNotNull(expression.leftHandSide); 5601 expect(expression.leftHandSide, isNotNull);
5604 JUnitTestCase.assertNotNull(expression.operator); 5602 expect(expression.operator, isNotNull);
5605 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type); 5603 expect(expression.operator.type, TokenType.EQ);
5606 JUnitTestCase.assertNotNull(expression.rightHandSide); 5604 expect(expression.rightHandSide, isNotNull);
5607 } 5605 }
5608 5606
5609 void test_parseExpressionWithoutCascade_comparison() { 5607 void test_parseExpressionWithoutCascade_comparison() {
5610 BinaryExpression expression = ParserTestCase.parse4("parseExpressionWithoutC ascade", "--a.b == c", []); 5608 BinaryExpression expression = ParserTestCase.parse4("parseExpressionWithoutC ascade", "--a.b == c", []);
5611 JUnitTestCase.assertNotNull(expression.leftOperand); 5609 expect(expression.leftOperand, isNotNull);
5612 JUnitTestCase.assertNotNull(expression.operator); 5610 expect(expression.operator, isNotNull);
5613 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 5611 expect(expression.operator.type, TokenType.EQ_EQ);
5614 JUnitTestCase.assertNotNull(expression.rightOperand); 5612 expect(expression.rightOperand, isNotNull);
5615 } 5613 }
5616 5614
5617 void test_parseExpressionWithoutCascade_superMethodInvocation() { 5615 void test_parseExpressionWithoutCascade_superMethodInvocation() {
5618 MethodInvocation invocation = ParserTestCase.parse4("parseExpressionWithoutC ascade", "super.m()", []); 5616 MethodInvocation invocation = ParserTestCase.parse4("parseExpressionWithoutC ascade", "super.m()", []);
5619 JUnitTestCase.assertNotNull(invocation.target); 5617 expect(invocation.target, isNotNull);
5620 JUnitTestCase.assertNotNull(invocation.methodName); 5618 expect(invocation.methodName, isNotNull);
5621 JUnitTestCase.assertNotNull(invocation.argumentList); 5619 expect(invocation.argumentList, isNotNull);
5622 } 5620 }
5623 5621
5624 void test_parseExtendsClause() { 5622 void test_parseExtendsClause() {
5625 ExtendsClause clause = ParserTestCase.parse4("parseExtendsClause", "extends B", []); 5623 ExtendsClause clause = ParserTestCase.parse4("parseExtendsClause", "extends B", []);
5626 JUnitTestCase.assertNotNull(clause.keyword); 5624 expect(clause.keyword, isNotNull);
5627 JUnitTestCase.assertNotNull(clause.superclass); 5625 expect(clause.superclass, isNotNull);
5628 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, clause.s uperclass); 5626 EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, clause.s uperclass);
5629 } 5627 }
5630 5628
5631 void test_parseFinalConstVarOrType_const_noType() { 5629 void test_parseFinalConstVarOrType_const_noType() {
5632 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const"); 5630 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const");
5633 Token keyword = result.keyword; 5631 Token keyword = result.keyword;
5634 JUnitTestCase.assertNotNull(keyword); 5632 expect(keyword, isNotNull);
5635 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5633 expect(keyword.type, TokenType.KEYWORD);
5636 JUnitTestCase.assertEquals(Keyword.CONST, (keyword as KeywordToken).keyword) ; 5634 expect((keyword as KeywordToken).keyword, Keyword.CONST);
5637 JUnitTestCase.assertNull(result.type); 5635 expect(result.type, isNull);
5638 } 5636 }
5639 5637
5640 void test_parseFinalConstVarOrType_const_type() { 5638 void test_parseFinalConstVarOrType_const_type() {
5641 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const A a"); 5639 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const A a");
5642 Token keyword = result.keyword; 5640 Token keyword = result.keyword;
5643 JUnitTestCase.assertNotNull(keyword); 5641 expect(keyword, isNotNull);
5644 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5642 expect(keyword.type, TokenType.KEYWORD);
5645 JUnitTestCase.assertEquals(Keyword.CONST, (keyword as KeywordToken).keyword) ; 5643 expect((keyword as KeywordToken).keyword, Keyword.CONST);
5646 JUnitTestCase.assertNotNull(result.type); 5644 expect(result.type, isNotNull);
5647 } 5645 }
5648 5646
5649 void test_parseFinalConstVarOrType_final_noType() { 5647 void test_parseFinalConstVarOrType_final_noType() {
5650 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final"); 5648 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final");
5651 Token keyword = result.keyword; 5649 Token keyword = result.keyword;
5652 JUnitTestCase.assertNotNull(keyword); 5650 expect(keyword, isNotNull);
5653 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5651 expect(keyword.type, TokenType.KEYWORD);
5654 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ; 5652 expect((keyword as KeywordToken).keyword, Keyword.FINAL);
5655 JUnitTestCase.assertNull(result.type); 5653 expect(result.type, isNull);
5656 } 5654 }
5657 5655
5658 void test_parseFinalConstVarOrType_final_prefixedType() { 5656 void test_parseFinalConstVarOrType_final_prefixedType() {
5659 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final p.A a"); 5657 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final p.A a");
5660 Token keyword = result.keyword; 5658 Token keyword = result.keyword;
5661 JUnitTestCase.assertNotNull(keyword); 5659 expect(keyword, isNotNull);
5662 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5660 expect(keyword.type, TokenType.KEYWORD);
5663 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ; 5661 expect((keyword as KeywordToken).keyword, Keyword.FINAL);
5664 JUnitTestCase.assertNotNull(result.type); 5662 expect(result.type, isNotNull);
5665 } 5663 }
5666 5664
5667 void test_parseFinalConstVarOrType_final_type() { 5665 void test_parseFinalConstVarOrType_final_type() {
5668 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a"); 5666 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a");
5669 Token keyword = result.keyword; 5667 Token keyword = result.keyword;
5670 JUnitTestCase.assertNotNull(keyword); 5668 expect(keyword, isNotNull);
5671 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5669 expect(keyword.type, TokenType.KEYWORD);
5672 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ; 5670 expect((keyword as KeywordToken).keyword, Keyword.FINAL);
5673 JUnitTestCase.assertNotNull(result.type); 5671 expect(result.type, isNotNull);
5674 } 5672 }
5675 5673
5676 void test_parseFinalConstVarOrType_type_parameterized() { 5674 void test_parseFinalConstVarOrType_type_parameterized() {
5677 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a"); 5675 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a");
5678 JUnitTestCase.assertNull(result.keyword); 5676 expect(result.keyword, isNull);
5679 JUnitTestCase.assertNotNull(result.type); 5677 expect(result.type, isNotNull);
5680 } 5678 }
5681 5679
5682 void test_parseFinalConstVarOrType_type_prefixed() { 5680 void test_parseFinalConstVarOrType_type_prefixed() {
5683 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A a"); 5681 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A a");
5684 JUnitTestCase.assertNull(result.keyword); 5682 expect(result.keyword, isNull);
5685 JUnitTestCase.assertNotNull(result.type); 5683 expect(result.type, isNotNull);
5686 } 5684 }
5687 5685
5688 void test_parseFinalConstVarOrType_type_prefixedAndParameterized() { 5686 void test_parseFinalConstVarOrType_type_prefixedAndParameterized() {
5689 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A<B> a"); 5687 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A<B> a");
5690 JUnitTestCase.assertNull(result.keyword); 5688 expect(result.keyword, isNull);
5691 JUnitTestCase.assertNotNull(result.type); 5689 expect(result.type, isNotNull);
5692 } 5690 }
5693 5691
5694 void test_parseFinalConstVarOrType_type_simple() { 5692 void test_parseFinalConstVarOrType_type_simple() {
5695 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A a"); 5693 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A a");
5696 JUnitTestCase.assertNull(result.keyword); 5694 expect(result.keyword, isNull);
5697 JUnitTestCase.assertNotNull(result.type); 5695 expect(result.type, isNotNull);
5698 } 5696 }
5699 5697
5700 void test_parseFinalConstVarOrType_var() { 5698 void test_parseFinalConstVarOrType_var() {
5701 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "var"); 5699 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "var");
5702 Token keyword = result.keyword; 5700 Token keyword = result.keyword;
5703 JUnitTestCase.assertNotNull(keyword); 5701 expect(keyword, isNotNull);
5704 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 5702 expect(keyword.type, TokenType.KEYWORD);
5705 JUnitTestCase.assertEquals(Keyword.VAR, (keyword as KeywordToken).keyword); 5703 expect((keyword as KeywordToken).keyword, Keyword.VAR);
5706 JUnitTestCase.assertNull(result.type); 5704 expect(result.type, isNull);
5707 } 5705 }
5708 5706
5709 void test_parseFormalParameter_final_withType_named() { 5707 void test_parseFormalParameter_final_withType_named() {
5710 ParameterKind kind = ParameterKind.NAMED; 5708 ParameterKind kind = ParameterKind.NAMED;
5711 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a : null"); 5709 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a : null");
5712 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5710 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5713 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5711 expect(simpleParameter.identifier, isNotNull);
5714 JUnitTestCase.assertNotNull(simpleParameter.keyword); 5712 expect(simpleParameter.keyword, isNotNull);
5715 JUnitTestCase.assertNotNull(simpleParameter.type); 5713 expect(simpleParameter.type, isNotNull);
5716 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5714 expect(simpleParameter.kind, kind);
5717 JUnitTestCase.assertNotNull(parameter.separator); 5715 expect(parameter.separator, isNotNull);
5718 JUnitTestCase.assertNotNull(parameter.defaultValue); 5716 expect(parameter.defaultValue, isNotNull);
5719 JUnitTestCase.assertEquals(kind, parameter.kind); 5717 expect(parameter.kind, kind);
5720 } 5718 }
5721 5719
5722 void test_parseFormalParameter_final_withType_normal() { 5720 void test_parseFormalParameter_final_withType_normal() {
5723 ParameterKind kind = ParameterKind.REQUIRED; 5721 ParameterKind kind = ParameterKind.REQUIRED;
5724 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "final A a"); 5722 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "final A a");
5725 JUnitTestCase.assertNotNull(parameter.identifier); 5723 expect(parameter.identifier, isNotNull);
5726 JUnitTestCase.assertNotNull(parameter.keyword); 5724 expect(parameter.keyword, isNotNull);
5727 JUnitTestCase.assertNotNull(parameter.type); 5725 expect(parameter.type, isNotNull);
5728 JUnitTestCase.assertEquals(kind, parameter.kind); 5726 expect(parameter.kind, kind);
5729 } 5727 }
5730 5728
5731 void test_parseFormalParameter_final_withType_positional() { 5729 void test_parseFormalParameter_final_withType_positional() {
5732 ParameterKind kind = ParameterKind.POSITIONAL; 5730 ParameterKind kind = ParameterKind.POSITIONAL;
5733 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a = null"); 5731 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a = null");
5734 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5732 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5735 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5733 expect(simpleParameter.identifier, isNotNull);
5736 JUnitTestCase.assertNotNull(simpleParameter.keyword); 5734 expect(simpleParameter.keyword, isNotNull);
5737 JUnitTestCase.assertNotNull(simpleParameter.type); 5735 expect(simpleParameter.type, isNotNull);
5738 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5736 expect(simpleParameter.kind, kind);
5739 JUnitTestCase.assertNotNull(parameter.separator); 5737 expect(parameter.separator, isNotNull);
5740 JUnitTestCase.assertNotNull(parameter.defaultValue); 5738 expect(parameter.defaultValue, isNotNull);
5741 JUnitTestCase.assertEquals(kind, parameter.kind); 5739 expect(parameter.kind, kind);
5742 } 5740 }
5743 5741
5744 void test_parseFormalParameter_nonFinal_withType_named() { 5742 void test_parseFormalParameter_nonFinal_withType_named() {
5745 ParameterKind kind = ParameterKind.NAMED; 5743 ParameterKind kind = ParameterKind.NAMED;
5746 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a : null"); 5744 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a : null");
5747 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5745 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5748 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5746 expect(simpleParameter.identifier, isNotNull);
5749 JUnitTestCase.assertNull(simpleParameter.keyword); 5747 expect(simpleParameter.keyword, isNull);
5750 JUnitTestCase.assertNotNull(simpleParameter.type); 5748 expect(simpleParameter.type, isNotNull);
5751 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5749 expect(simpleParameter.kind, kind);
5752 JUnitTestCase.assertNotNull(parameter.separator); 5750 expect(parameter.separator, isNotNull);
5753 JUnitTestCase.assertNotNull(parameter.defaultValue); 5751 expect(parameter.defaultValue, isNotNull);
5754 JUnitTestCase.assertEquals(kind, parameter.kind); 5752 expect(parameter.kind, kind);
5755 } 5753 }
5756 5754
5757 void test_parseFormalParameter_nonFinal_withType_normal() { 5755 void test_parseFormalParameter_nonFinal_withType_normal() {
5758 ParameterKind kind = ParameterKind.REQUIRED; 5756 ParameterKind kind = ParameterKind.REQUIRED;
5759 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "A a"); 5757 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "A a");
5760 JUnitTestCase.assertNotNull(parameter.identifier); 5758 expect(parameter.identifier, isNotNull);
5761 JUnitTestCase.assertNull(parameter.keyword); 5759 expect(parameter.keyword, isNull);
5762 JUnitTestCase.assertNotNull(parameter.type); 5760 expect(parameter.type, isNotNull);
5763 JUnitTestCase.assertEquals(kind, parameter.kind); 5761 expect(parameter.kind, kind);
5764 } 5762 }
5765 5763
5766 void test_parseFormalParameter_nonFinal_withType_positional() { 5764 void test_parseFormalParameter_nonFinal_withType_positional() {
5767 ParameterKind kind = ParameterKind.POSITIONAL; 5765 ParameterKind kind = ParameterKind.POSITIONAL;
5768 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a = null"); 5766 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a = null");
5769 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5767 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5770 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5768 expect(simpleParameter.identifier, isNotNull);
5771 JUnitTestCase.assertNull(simpleParameter.keyword); 5769 expect(simpleParameter.keyword, isNull);
5772 JUnitTestCase.assertNotNull(simpleParameter.type); 5770 expect(simpleParameter.type, isNotNull);
5773 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5771 expect(simpleParameter.kind, kind);
5774 JUnitTestCase.assertNotNull(parameter.separator); 5772 expect(parameter.separator, isNotNull);
5775 JUnitTestCase.assertNotNull(parameter.defaultValue); 5773 expect(parameter.defaultValue, isNotNull);
5776 JUnitTestCase.assertEquals(kind, parameter.kind); 5774 expect(parameter.kind, kind);
5777 } 5775 }
5778 5776
5779 void test_parseFormalParameter_var() { 5777 void test_parseFormalParameter_var() {
5780 ParameterKind kind = ParameterKind.REQUIRED; 5778 ParameterKind kind = ParameterKind.REQUIRED;
5781 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "var a"); 5779 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "var a");
5782 JUnitTestCase.assertNotNull(parameter.identifier); 5780 expect(parameter.identifier, isNotNull);
5783 JUnitTestCase.assertNotNull(parameter.keyword); 5781 expect(parameter.keyword, isNotNull);
5784 JUnitTestCase.assertNull(parameter.type); 5782 expect(parameter.type, isNull);
5785 JUnitTestCase.assertEquals(kind, parameter.kind); 5783 expect(parameter.kind, kind);
5786 } 5784 }
5787 5785
5788 void test_parseFormalParameter_var_named() { 5786 void test_parseFormalParameter_var_named() {
5789 ParameterKind kind = ParameterKind.NAMED; 5787 ParameterKind kind = ParameterKind.NAMED;
5790 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a : null"); 5788 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a : null");
5791 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5789 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5792 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5790 expect(simpleParameter.identifier, isNotNull);
5793 JUnitTestCase.assertNotNull(simpleParameter.keyword); 5791 expect(simpleParameter.keyword, isNotNull);
5794 JUnitTestCase.assertNull(simpleParameter.type); 5792 expect(simpleParameter.type, isNull);
5795 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5793 expect(simpleParameter.kind, kind);
5796 JUnitTestCase.assertNotNull(parameter.separator); 5794 expect(parameter.separator, isNotNull);
5797 JUnitTestCase.assertNotNull(parameter.defaultValue); 5795 expect(parameter.defaultValue, isNotNull);
5798 JUnitTestCase.assertEquals(kind, parameter.kind); 5796 expect(parameter.kind, kind);
5799 } 5797 }
5800 5798
5801 void test_parseFormalParameter_var_positional() { 5799 void test_parseFormalParameter_var_positional() {
5802 ParameterKind kind = ParameterKind.POSITIONAL; 5800 ParameterKind kind = ParameterKind.POSITIONAL;
5803 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a = null"); 5801 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a = null");
5804 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 5802 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
5805 JUnitTestCase.assertNotNull(simpleParameter.identifier); 5803 expect(simpleParameter.identifier, isNotNull);
5806 JUnitTestCase.assertNotNull(simpleParameter.keyword); 5804 expect(simpleParameter.keyword, isNotNull);
5807 JUnitTestCase.assertNull(simpleParameter.type); 5805 expect(simpleParameter.type, isNull);
5808 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 5806 expect(simpleParameter.kind, kind);
5809 JUnitTestCase.assertNotNull(parameter.separator); 5807 expect(parameter.separator, isNotNull);
5810 JUnitTestCase.assertNotNull(parameter.defaultValue); 5808 expect(parameter.defaultValue, isNotNull);
5811 JUnitTestCase.assertEquals(kind, parameter.kind); 5809 expect(parameter.kind, kind);
5812 } 5810 }
5813 5811
5814 void test_parseFormalParameterList_empty() { 5812 void test_parseFormalParameterList_empty() {
5815 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "()", []); 5813 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "()", []);
5816 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5814 expect(parameterList.leftParenthesis, isNotNull);
5817 JUnitTestCase.assertNull(parameterList.leftDelimiter); 5815 expect(parameterList.leftDelimiter, isNull);
5818 EngineTestCase.assertSizeOfList(0, parameterList.parameters); 5816 EngineTestCase.assertSizeOfList(0, parameterList.parameters);
5819 JUnitTestCase.assertNull(parameterList.rightDelimiter); 5817 expect(parameterList.rightDelimiter, isNull);
5820 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5818 expect(parameterList.rightParenthesis, isNotNull);
5821 } 5819 }
5822 5820
5823 void test_parseFormalParameterList_named_multiple() { 5821 void test_parseFormalParameterList_named_multiple() {
5824 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})", []);
5825 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5823 expect(parameterList.leftParenthesis, isNotNull);
5826 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5824 expect(parameterList.leftDelimiter, isNotNull);
5827 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5825 EngineTestCase.assertSizeOfList(3, parameterList.parameters);
5828 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5826 expect(parameterList.rightDelimiter, isNotNull);
5829 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5827 expect(parameterList.rightParenthesis, isNotNull);
5830 } 5828 }
5831 5829
5832 void test_parseFormalParameterList_named_single() { 5830 void test_parseFormalParameterList_named_single() {
5833 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a})", []); 5831 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "({A a})", []);
5834 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5832 expect(parameterList.leftParenthesis, isNotNull);
5835 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5833 expect(parameterList.leftDelimiter, isNotNull);
5836 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5834 EngineTestCase.assertSizeOfList(1, parameterList.parameters);
5837 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5835 expect(parameterList.rightDelimiter, isNotNull);
5838 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5836 expect(parameterList.rightParenthesis, isNotNull);
5839 } 5837 }
5840 5838
5841 void test_parseFormalParameterList_normal_multiple() { 5839 void test_parseFormalParameterList_normal_multiple() {
5842 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)", []);
5843 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5841 expect(parameterList.leftParenthesis, isNotNull);
5844 JUnitTestCase.assertNull(parameterList.leftDelimiter); 5842 expect(parameterList.leftDelimiter, isNull);
5845 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5843 EngineTestCase.assertSizeOfList(3, parameterList.parameters);
5846 JUnitTestCase.assertNull(parameterList.rightDelimiter); 5844 expect(parameterList.rightDelimiter, isNull);
5847 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5845 expect(parameterList.rightParenthesis, isNotNull);
5848 } 5846 }
5849 5847
5850 void test_parseFormalParameterList_normal_named() { 5848 void test_parseFormalParameterList_normal_named() {
5851 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, {B b})", []); 5849 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, {B b})", []);
5852 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5850 expect(parameterList.leftParenthesis, isNotNull);
5853 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5851 expect(parameterList.leftDelimiter, isNotNull);
5854 EngineTestCase.assertSizeOfList(2, parameterList.parameters); 5852 EngineTestCase.assertSizeOfList(2, parameterList.parameters);
5855 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5853 expect(parameterList.rightDelimiter, isNotNull);
5856 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5854 expect(parameterList.rightParenthesis, isNotNull);
5857 } 5855 }
5858 5856
5859 void test_parseFormalParameterList_normal_positional() { 5857 void test_parseFormalParameterList_normal_positional() {
5860 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, [B b])", []); 5858 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a, [B b])", []);
5861 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5859 expect(parameterList.leftParenthesis, isNotNull);
5862 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5860 expect(parameterList.leftDelimiter, isNotNull);
5863 EngineTestCase.assertSizeOfList(2, parameterList.parameters); 5861 EngineTestCase.assertSizeOfList(2, parameterList.parameters);
5864 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5862 expect(parameterList.rightDelimiter, isNotNull);
5865 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5863 expect(parameterList.rightParenthesis, isNotNull);
5866 } 5864 }
5867 5865
5868 void test_parseFormalParameterList_normal_single() { 5866 void test_parseFormalParameterList_normal_single() {
5869 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a)", []); 5867 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "(A a)", []);
5870 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5868 expect(parameterList.leftParenthesis, isNotNull);
5871 JUnitTestCase.assertNull(parameterList.leftDelimiter); 5869 expect(parameterList.leftDelimiter, isNull);
5872 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5870 EngineTestCase.assertSizeOfList(1, parameterList.parameters);
5873 JUnitTestCase.assertNull(parameterList.rightDelimiter); 5871 expect(parameterList.rightDelimiter, isNull);
5874 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5872 expect(parameterList.rightParenthesis, isNotNull);
5875 } 5873 }
5876 5874
5877 void test_parseFormalParameterList_positional_multiple() { 5875 void test_parseFormalParameterList_positional_multiple() {
5878 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])", []);
5879 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5877 expect(parameterList.leftParenthesis, isNotNull);
5880 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5878 expect(parameterList.leftDelimiter, isNotNull);
5881 EngineTestCase.assertSizeOfList(3, parameterList.parameters); 5879 EngineTestCase.assertSizeOfList(3, parameterList.parameters);
5882 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5880 expect(parameterList.rightDelimiter, isNotNull);
5883 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5881 expect(parameterList.rightParenthesis, isNotNull);
5884 } 5882 }
5885 5883
5886 void test_parseFormalParameterList_positional_single() { 5884 void test_parseFormalParameterList_positional_single() {
5887 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null])", []); 5885 FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParame terList", "([A a = null])", []);
5888 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 5886 expect(parameterList.leftParenthesis, isNotNull);
5889 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 5887 expect(parameterList.leftDelimiter, isNotNull);
5890 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 5888 EngineTestCase.assertSizeOfList(1, parameterList.parameters);
5891 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 5889 expect(parameterList.rightDelimiter, isNotNull);
5892 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 5890 expect(parameterList.rightParenthesis, isNotNull);
5893 } 5891 }
5894 5892
5895 void test_parseForStatement_each_await() { 5893 void test_parseForStatement_each_await() {
5896 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "awa it for (element in list) {}", []); 5894 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "awa it for (element in list) {}", []);
5897 JUnitTestCase.assertNotNull(statement.awaitKeyword); 5895 expect(statement.awaitKeyword, isNotNull);
5898 JUnitTestCase.assertNotNull(statement.forKeyword); 5896 expect(statement.forKeyword, isNotNull);
5899 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5897 expect(statement.leftParenthesis, isNotNull);
5900 JUnitTestCase.assertNull(statement.loopVariable); 5898 expect(statement.loopVariable, isNull);
5901 JUnitTestCase.assertNotNull(statement.identifier); 5899 expect(statement.identifier, isNotNull);
5902 JUnitTestCase.assertNotNull(statement.inKeyword); 5900 expect(statement.inKeyword, isNotNull);
5903 JUnitTestCase.assertNotNull(statement.iterator); 5901 expect(statement.iterator, isNotNull);
5904 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5902 expect(statement.rightParenthesis, isNotNull);
5905 JUnitTestCase.assertNotNull(statement.body); 5903 expect(statement.body, isNotNull);
5906 } 5904 }
5907 5905
5908 void test_parseForStatement_each_identifier() { 5906 void test_parseForStatement_each_identifier() {
5909 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (element in list) {}", []); 5907 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (element in list) {}", []);
5910 JUnitTestCase.assertNull(statement.awaitKeyword); 5908 expect(statement.awaitKeyword, isNull);
5911 JUnitTestCase.assertNotNull(statement.forKeyword); 5909 expect(statement.forKeyword, isNotNull);
5912 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5910 expect(statement.leftParenthesis, isNotNull);
5913 JUnitTestCase.assertNull(statement.loopVariable); 5911 expect(statement.loopVariable, isNull);
5914 JUnitTestCase.assertNotNull(statement.identifier); 5912 expect(statement.identifier, isNotNull);
5915 JUnitTestCase.assertNotNull(statement.inKeyword); 5913 expect(statement.inKeyword, isNotNull);
5916 JUnitTestCase.assertNotNull(statement.iterator); 5914 expect(statement.iterator, isNotNull);
5917 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5915 expect(statement.rightParenthesis, isNotNull);
5918 JUnitTestCase.assertNotNull(statement.body); 5916 expect(statement.body, isNotNull);
5919 } 5917 }
5920 5918
5921 void test_parseForStatement_each_noType_metadata() { 5919 void test_parseForStatement_each_noType_metadata() {
5922 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}", []); 5920 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}", []);
5923 JUnitTestCase.assertNull(statement.awaitKeyword); 5921 expect(statement.awaitKeyword, isNull);
5924 JUnitTestCase.assertNotNull(statement.forKeyword); 5922 expect(statement.forKeyword, isNotNull);
5925 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5923 expect(statement.leftParenthesis, isNotNull);
5926 JUnitTestCase.assertNotNull(statement.loopVariable); 5924 expect(statement.loopVariable, isNotNull);
5927 EngineTestCase.assertSizeOfList(1, statement.loopVariable.metadata); 5925 EngineTestCase.assertSizeOfList(1, statement.loopVariable.metadata);
5928 JUnitTestCase.assertNull(statement.identifier); 5926 expect(statement.identifier, isNull);
5929 JUnitTestCase.assertNotNull(statement.inKeyword); 5927 expect(statement.inKeyword, isNotNull);
5930 JUnitTestCase.assertNotNull(statement.iterator); 5928 expect(statement.iterator, isNotNull);
5931 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5929 expect(statement.rightParenthesis, isNotNull);
5932 JUnitTestCase.assertNotNull(statement.body); 5930 expect(statement.body, isNotNull);
5933 } 5931 }
5934 5932
5935 void test_parseForStatement_each_type() { 5933 void test_parseForStatement_each_type() {
5936 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (A element in list) {}", []); 5934 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (A element in list) {}", []);
5937 JUnitTestCase.assertNull(statement.awaitKeyword); 5935 expect(statement.awaitKeyword, isNull);
5938 JUnitTestCase.assertNotNull(statement.forKeyword); 5936 expect(statement.forKeyword, isNotNull);
5939 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5937 expect(statement.leftParenthesis, isNotNull);
5940 JUnitTestCase.assertNotNull(statement.loopVariable); 5938 expect(statement.loopVariable, isNotNull);
5941 JUnitTestCase.assertNull(statement.identifier); 5939 expect(statement.identifier, isNull);
5942 JUnitTestCase.assertNotNull(statement.inKeyword); 5940 expect(statement.inKeyword, isNotNull);
5943 JUnitTestCase.assertNotNull(statement.iterator); 5941 expect(statement.iterator, isNotNull);
5944 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5942 expect(statement.rightParenthesis, isNotNull);
5945 JUnitTestCase.assertNotNull(statement.body); 5943 expect(statement.body, isNotNull);
5946 } 5944 }
5947 5945
5948 void test_parseForStatement_each_var() { 5946 void test_parseForStatement_each_var() {
5949 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (var element in list) {}", []); 5947 ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (var element in list) {}", []);
5950 JUnitTestCase.assertNull(statement.awaitKeyword); 5948 expect(statement.awaitKeyword, isNull);
5951 JUnitTestCase.assertNotNull(statement.forKeyword); 5949 expect(statement.forKeyword, isNotNull);
5952 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5950 expect(statement.leftParenthesis, isNotNull);
5953 JUnitTestCase.assertNotNull(statement.loopVariable); 5951 expect(statement.loopVariable, isNotNull);
5954 JUnitTestCase.assertNull(statement.identifier); 5952 expect(statement.identifier, isNull);
5955 JUnitTestCase.assertNotNull(statement.inKeyword); 5953 expect(statement.inKeyword, isNotNull);
5956 JUnitTestCase.assertNotNull(statement.iterator); 5954 expect(statement.iterator, isNotNull);
5957 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5955 expect(statement.rightParenthesis, isNotNull);
5958 JUnitTestCase.assertNotNull(statement.body); 5956 expect(statement.body, isNotNull);
5959 } 5957 }
5960 5958
5961 void test_parseForStatement_loop_c() { 5959 void test_parseForStatement_loop_c() {
5962 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}", []); 5960 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}", []);
5963 JUnitTestCase.assertNotNull(statement.forKeyword); 5961 expect(statement.forKeyword, isNotNull);
5964 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5962 expect(statement.leftParenthesis, isNotNull);
5965 JUnitTestCase.assertNull(statement.variables); 5963 expect(statement.variables, isNull);
5966 JUnitTestCase.assertNull(statement.initialization); 5964 expect(statement.initialization, isNull);
5967 JUnitTestCase.assertNotNull(statement.leftSeparator); 5965 expect(statement.leftSeparator, isNotNull);
5968 JUnitTestCase.assertNotNull(statement.condition); 5966 expect(statement.condition, isNotNull);
5969 JUnitTestCase.assertNotNull(statement.rightSeparator); 5967 expect(statement.rightSeparator, isNotNull);
5970 EngineTestCase.assertSizeOfList(0, statement.updaters); 5968 EngineTestCase.assertSizeOfList(0, statement.updaters);
5971 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5969 expect(statement.rightParenthesis, isNotNull);
5972 JUnitTestCase.assertNotNull(statement.body); 5970 expect(statement.body, isNotNull);
5973 } 5971 }
5974 5972
5975 void test_parseForStatement_loop_cu() { 5973 void test_parseForStatement_loop_cu() {
5976 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}", []); 5974 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}", []);
5977 JUnitTestCase.assertNotNull(statement.forKeyword); 5975 expect(statement.forKeyword, isNotNull);
5978 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5976 expect(statement.leftParenthesis, isNotNull);
5979 JUnitTestCase.assertNull(statement.variables); 5977 expect(statement.variables, isNull);
5980 JUnitTestCase.assertNull(statement.initialization); 5978 expect(statement.initialization, isNull);
5981 JUnitTestCase.assertNotNull(statement.leftSeparator); 5979 expect(statement.leftSeparator, isNotNull);
5982 JUnitTestCase.assertNotNull(statement.condition); 5980 expect(statement.condition, isNotNull);
5983 JUnitTestCase.assertNotNull(statement.rightSeparator); 5981 expect(statement.rightSeparator, isNotNull);
5984 EngineTestCase.assertSizeOfList(1, statement.updaters); 5982 EngineTestCase.assertSizeOfList(1, statement.updaters);
5985 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5983 expect(statement.rightParenthesis, isNotNull);
5986 JUnitTestCase.assertNotNull(statement.body); 5984 expect(statement.body, isNotNull);
5987 } 5985 }
5988 5986
5989 void test_parseForStatement_loop_ecu() { 5987 void test_parseForStatement_loop_ecu() {
5990 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (i- -; i < count; i++) {}", []); 5988 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (i- -; i < count; i++) {}", []);
5991 JUnitTestCase.assertNotNull(statement.forKeyword); 5989 expect(statement.forKeyword, isNotNull);
5992 JUnitTestCase.assertNotNull(statement.leftParenthesis); 5990 expect(statement.leftParenthesis, isNotNull);
5993 JUnitTestCase.assertNull(statement.variables); 5991 expect(statement.variables, isNull);
5994 JUnitTestCase.assertNotNull(statement.initialization); 5992 expect(statement.initialization, isNotNull);
5995 JUnitTestCase.assertNotNull(statement.leftSeparator); 5993 expect(statement.leftSeparator, isNotNull);
5996 JUnitTestCase.assertNotNull(statement.condition); 5994 expect(statement.condition, isNotNull);
5997 JUnitTestCase.assertNotNull(statement.rightSeparator); 5995 expect(statement.rightSeparator, isNotNull);
5998 EngineTestCase.assertSizeOfList(1, statement.updaters); 5996 EngineTestCase.assertSizeOfList(1, statement.updaters);
5999 JUnitTestCase.assertNotNull(statement.rightParenthesis); 5997 expect(statement.rightParenthesis, isNotNull);
6000 JUnitTestCase.assertNotNull(statement.body); 5998 expect(statement.body, isNotNull);
6001 } 5999 }
6002 6000
6003 void test_parseForStatement_loop_i() { 6001 void test_parseForStatement_loop_i() {
6004 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;;) {}", []); 6002 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;;) {}", []);
6005 JUnitTestCase.assertNotNull(statement.forKeyword); 6003 expect(statement.forKeyword, isNotNull);
6006 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6004 expect(statement.leftParenthesis, isNotNull);
6007 VariableDeclarationList variables = statement.variables; 6005 VariableDeclarationList variables = statement.variables;
6008 JUnitTestCase.assertNotNull(variables); 6006 expect(variables, isNotNull);
6009 EngineTestCase.assertSizeOfList(0, variables.metadata); 6007 EngineTestCase.assertSizeOfList(0, variables.metadata);
6010 EngineTestCase.assertSizeOfList(1, variables.variables); 6008 EngineTestCase.assertSizeOfList(1, variables.variables);
6011 JUnitTestCase.assertNull(statement.initialization); 6009 expect(statement.initialization, isNull);
6012 JUnitTestCase.assertNotNull(statement.leftSeparator); 6010 expect(statement.leftSeparator, isNotNull);
6013 JUnitTestCase.assertNull(statement.condition); 6011 expect(statement.condition, isNull);
6014 JUnitTestCase.assertNotNull(statement.rightSeparator); 6012 expect(statement.rightSeparator, isNotNull);
6015 EngineTestCase.assertSizeOfList(0, statement.updaters); 6013 EngineTestCase.assertSizeOfList(0, statement.updaters);
6016 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6014 expect(statement.rightParenthesis, isNotNull);
6017 JUnitTestCase.assertNotNull(statement.body); 6015 expect(statement.body, isNotNull);
6018 } 6016 }
6019 6017
6020 void test_parseForStatement_loop_i_withMetadata() { 6018 void test_parseForStatement_loop_i_withMetadata() {
6021 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}", []); 6019 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}", []);
6022 JUnitTestCase.assertNotNull(statement.forKeyword); 6020 expect(statement.forKeyword, isNotNull);
6023 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6021 expect(statement.leftParenthesis, isNotNull);
6024 VariableDeclarationList variables = statement.variables; 6022 VariableDeclarationList variables = statement.variables;
6025 JUnitTestCase.assertNotNull(variables); 6023 expect(variables, isNotNull);
6026 EngineTestCase.assertSizeOfList(1, variables.metadata); 6024 EngineTestCase.assertSizeOfList(1, variables.metadata);
6027 EngineTestCase.assertSizeOfList(1, variables.variables); 6025 EngineTestCase.assertSizeOfList(1, variables.variables);
6028 JUnitTestCase.assertNull(statement.initialization); 6026 expect(statement.initialization, isNull);
6029 JUnitTestCase.assertNotNull(statement.leftSeparator); 6027 expect(statement.leftSeparator, isNotNull);
6030 JUnitTestCase.assertNull(statement.condition); 6028 expect(statement.condition, isNull);
6031 JUnitTestCase.assertNotNull(statement.rightSeparator); 6029 expect(statement.rightSeparator, isNotNull);
6032 EngineTestCase.assertSizeOfList(0, statement.updaters); 6030 EngineTestCase.assertSizeOfList(0, statement.updaters);
6033 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6031 expect(statement.rightParenthesis, isNotNull);
6034 JUnitTestCase.assertNotNull(statement.body); 6032 expect(statement.body, isNotNull);
6035 } 6033 }
6036 6034
6037 void test_parseForStatement_loop_ic() { 6035 void test_parseForStatement_loop_ic() {
6038 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;) {}", []);
6039 JUnitTestCase.assertNotNull(statement.forKeyword); 6037 expect(statement.forKeyword, isNotNull);
6040 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6038 expect(statement.leftParenthesis, isNotNull);
6041 VariableDeclarationList variables = statement.variables; 6039 VariableDeclarationList variables = statement.variables;
6042 JUnitTestCase.assertNotNull(variables); 6040 expect(variables, isNotNull);
6043 EngineTestCase.assertSizeOfList(1, variables.variables); 6041 EngineTestCase.assertSizeOfList(1, variables.variables);
6044 JUnitTestCase.assertNull(statement.initialization); 6042 expect(statement.initialization, isNull);
6045 JUnitTestCase.assertNotNull(statement.leftSeparator); 6043 expect(statement.leftSeparator, isNotNull);
6046 JUnitTestCase.assertNotNull(statement.condition); 6044 expect(statement.condition, isNotNull);
6047 JUnitTestCase.assertNotNull(statement.rightSeparator); 6045 expect(statement.rightSeparator, isNotNull);
6048 EngineTestCase.assertSizeOfList(0, statement.updaters); 6046 EngineTestCase.assertSizeOfList(0, statement.updaters);
6049 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6047 expect(statement.rightParenthesis, isNotNull);
6050 JUnitTestCase.assertNotNull(statement.body); 6048 expect(statement.body, isNotNull);
6051 } 6049 }
6052 6050
6053 void test_parseForStatement_loop_icu() { 6051 void test_parseForStatement_loop_icu() {
6054 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++) {}", []);
6055 JUnitTestCase.assertNotNull(statement.forKeyword); 6053 expect(statement.forKeyword, isNotNull);
6056 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6054 expect(statement.leftParenthesis, isNotNull);
6057 VariableDeclarationList variables = statement.variables; 6055 VariableDeclarationList variables = statement.variables;
6058 JUnitTestCase.assertNotNull(variables); 6056 expect(variables, isNotNull);
6059 EngineTestCase.assertSizeOfList(1, variables.variables); 6057 EngineTestCase.assertSizeOfList(1, variables.variables);
6060 JUnitTestCase.assertNull(statement.initialization); 6058 expect(statement.initialization, isNull);
6061 JUnitTestCase.assertNotNull(statement.leftSeparator); 6059 expect(statement.leftSeparator, isNotNull);
6062 JUnitTestCase.assertNotNull(statement.condition); 6060 expect(statement.condition, isNotNull);
6063 JUnitTestCase.assertNotNull(statement.rightSeparator); 6061 expect(statement.rightSeparator, isNotNull);
6064 EngineTestCase.assertSizeOfList(1, statement.updaters); 6062 EngineTestCase.assertSizeOfList(1, statement.updaters);
6065 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6063 expect(statement.rightParenthesis, isNotNull);
6066 JUnitTestCase.assertNotNull(statement.body); 6064 expect(statement.body, isNotNull);
6067 } 6065 }
6068 6066
6069 void test_parseForStatement_loop_iicuu() { 6067 void test_parseForStatement_loop_iicuu() {
6070 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--) {}", []);
6071 JUnitTestCase.assertNotNull(statement.forKeyword); 6069 expect(statement.forKeyword, isNotNull);
6072 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6070 expect(statement.leftParenthesis, isNotNull);
6073 VariableDeclarationList variables = statement.variables; 6071 VariableDeclarationList variables = statement.variables;
6074 JUnitTestCase.assertNotNull(variables); 6072 expect(variables, isNotNull);
6075 EngineTestCase.assertSizeOfList(2, variables.variables); 6073 EngineTestCase.assertSizeOfList(2, variables.variables);
6076 JUnitTestCase.assertNull(statement.initialization); 6074 expect(statement.initialization, isNull);
6077 JUnitTestCase.assertNotNull(statement.leftSeparator); 6075 expect(statement.leftSeparator, isNotNull);
6078 JUnitTestCase.assertNotNull(statement.condition); 6076 expect(statement.condition, isNotNull);
6079 JUnitTestCase.assertNotNull(statement.rightSeparator); 6077 expect(statement.rightSeparator, isNotNull);
6080 EngineTestCase.assertSizeOfList(2, statement.updaters); 6078 EngineTestCase.assertSizeOfList(2, statement.updaters);
6081 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6079 expect(statement.rightParenthesis, isNotNull);
6082 JUnitTestCase.assertNotNull(statement.body); 6080 expect(statement.body, isNotNull);
6083 } 6081 }
6084 6082
6085 void test_parseForStatement_loop_iu() { 6083 void test_parseForStatement_loop_iu() {
6086 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;; i++) {}", []); 6084 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (va r i = 0;; i++) {}", []);
6087 JUnitTestCase.assertNotNull(statement.forKeyword); 6085 expect(statement.forKeyword, isNotNull);
6088 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6086 expect(statement.leftParenthesis, isNotNull);
6089 VariableDeclarationList variables = statement.variables; 6087 VariableDeclarationList variables = statement.variables;
6090 JUnitTestCase.assertNotNull(variables); 6088 expect(variables, isNotNull);
6091 EngineTestCase.assertSizeOfList(1, variables.variables); 6089 EngineTestCase.assertSizeOfList(1, variables.variables);
6092 JUnitTestCase.assertNull(statement.initialization); 6090 expect(statement.initialization, isNull);
6093 JUnitTestCase.assertNotNull(statement.leftSeparator); 6091 expect(statement.leftSeparator, isNotNull);
6094 JUnitTestCase.assertNull(statement.condition); 6092 expect(statement.condition, isNull);
6095 JUnitTestCase.assertNotNull(statement.rightSeparator); 6093 expect(statement.rightSeparator, isNotNull);
6096 EngineTestCase.assertSizeOfList(1, statement.updaters); 6094 EngineTestCase.assertSizeOfList(1, statement.updaters);
6097 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6095 expect(statement.rightParenthesis, isNotNull);
6098 JUnitTestCase.assertNotNull(statement.body); 6096 expect(statement.body, isNotNull);
6099 } 6097 }
6100 6098
6101 void test_parseForStatement_loop_u() { 6099 void test_parseForStatement_loop_u() {
6102 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (;; i++) {}", []); 6100 ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (;; i++) {}", []);
6103 JUnitTestCase.assertNotNull(statement.forKeyword); 6101 expect(statement.forKeyword, isNotNull);
6104 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6102 expect(statement.leftParenthesis, isNotNull);
6105 JUnitTestCase.assertNull(statement.variables); 6103 expect(statement.variables, isNull);
6106 JUnitTestCase.assertNull(statement.initialization); 6104 expect(statement.initialization, isNull);
6107 JUnitTestCase.assertNotNull(statement.leftSeparator); 6105 expect(statement.leftSeparator, isNotNull);
6108 JUnitTestCase.assertNull(statement.condition); 6106 expect(statement.condition, isNull);
6109 JUnitTestCase.assertNotNull(statement.rightSeparator); 6107 expect(statement.rightSeparator, isNotNull);
6110 EngineTestCase.assertSizeOfList(1, statement.updaters); 6108 EngineTestCase.assertSizeOfList(1, statement.updaters);
6111 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6109 expect(statement.rightParenthesis, isNotNull);
6112 JUnitTestCase.assertNotNull(statement.body); 6110 expect(statement.body, isNotNull);
6113 } 6111 }
6114 6112
6115 void test_parseFunctionBody_block() { 6113 void test_parseFunctionBody_block() {
6116 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}"); 6114 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}");
6117 JUnitTestCase.assertNull(functionBody.keyword); 6115 expect(functionBody.keyword, isNull);
6118 JUnitTestCase.assertNull(functionBody.star); 6116 expect(functionBody.star, isNull);
6119 JUnitTestCase.assertNotNull(functionBody.block); 6117 expect(functionBody.block, isNotNull);
6120 JUnitTestCase.assertFalse(functionBody.isAsynchronous); 6118 expect(functionBody.isAsynchronous, isFalse);
6121 JUnitTestCase.assertFalse(functionBody.isGenerator); 6119 expect(functionBody.isGenerator, isFalse);
6122 JUnitTestCase.assertTrue(functionBody.isSynchronous); 6120 expect(functionBody.isSynchronous, isTrue);
6123 } 6121 }
6124 6122
6125 void test_parseFunctionBody_block_async() { 6123 void test_parseFunctionBody_block_async() {
6126 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "async {}"); 6124 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "async {}");
6127 JUnitTestCase.assertNotNull(functionBody.keyword); 6125 expect(functionBody.keyword, isNotNull);
6128 JUnitTestCase.assertEquals(Parser.ASYNC, functionBody.keyword.lexeme); 6126 expect(functionBody.keyword.lexeme, Parser.ASYNC);
6129 JUnitTestCase.assertNull(functionBody.star); 6127 expect(functionBody.star, isNull);
6130 JUnitTestCase.assertNotNull(functionBody.block); 6128 expect(functionBody.block, isNotNull);
6131 JUnitTestCase.assertTrue(functionBody.isAsynchronous); 6129 expect(functionBody.isAsynchronous, isTrue);
6132 JUnitTestCase.assertFalse(functionBody.isGenerator); 6130 expect(functionBody.isGenerator, isFalse);
6133 JUnitTestCase.assertFalse(functionBody.isSynchronous); 6131 expect(functionBody.isSynchronous, isFalse);
6134 } 6132 }
6135 6133
6136 void test_parseFunctionBody_block_asyncGenerator() { 6134 void test_parseFunctionBody_block_asyncGenerator() {
6137 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "async* {}"); 6135 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "async* {}");
6138 JUnitTestCase.assertNotNull(functionBody.keyword); 6136 expect(functionBody.keyword, isNotNull);
6139 JUnitTestCase.assertEquals(Parser.ASYNC, functionBody.keyword.lexeme); 6137 expect(functionBody.keyword.lexeme, Parser.ASYNC);
6140 JUnitTestCase.assertNotNull(functionBody.star); 6138 expect(functionBody.star, isNotNull);
6141 JUnitTestCase.assertNotNull(functionBody.block); 6139 expect(functionBody.block, isNotNull);
6142 JUnitTestCase.assertTrue(functionBody.isAsynchronous); 6140 expect(functionBody.isAsynchronous, isTrue);
6143 JUnitTestCase.assertTrue(functionBody.isGenerator); 6141 expect(functionBody.isGenerator, isTrue);
6144 JUnitTestCase.assertFalse(functionBody.isSynchronous); 6142 expect(functionBody.isSynchronous, isFalse);
6145 } 6143 }
6146 6144
6147 void test_parseFunctionBody_block_syncGenerator() { 6145 void test_parseFunctionBody_block_syncGenerator() {
6148 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "sync* {}"); 6146 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "sync* {}");
6149 JUnitTestCase.assertNotNull(functionBody.keyword); 6147 expect(functionBody.keyword, isNotNull);
6150 JUnitTestCase.assertEquals(Parser.SYNC, functionBody.keyword.lexeme); 6148 expect(functionBody.keyword.lexeme, Parser.SYNC);
6151 JUnitTestCase.assertNotNull(functionBody.star); 6149 expect(functionBody.star, isNotNull);
6152 JUnitTestCase.assertNotNull(functionBody.block); 6150 expect(functionBody.block, isNotNull);
6153 JUnitTestCase.assertFalse(functionBody.isAsynchronous); 6151 expect(functionBody.isAsynchronous, isFalse);
6154 JUnitTestCase.assertTrue(functionBody.isGenerator); 6152 expect(functionBody.isGenerator, isTrue);
6155 JUnitTestCase.assertTrue(functionBody.isSynchronous); 6153 expect(functionBody.isSynchronous, isTrue);
6156 } 6154 }
6157 6155
6158 void test_parseFunctionBody_empty() { 6156 void test_parseFunctionBody_empty() {
6159 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, null, false], ";"); 6157 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, null, false], ";");
6160 JUnitTestCase.assertNotNull(functionBody.semicolon); 6158 expect(functionBody.semicolon, isNotNull);
6161 } 6159 }
6162 6160
6163 void test_parseFunctionBody_expression() { 6161 void test_parseFunctionBody_expression() {
6164 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "=> y;"); 6162 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "=> y;");
6165 JUnitTestCase.assertNull(functionBody.keyword); 6163 expect(functionBody.keyword, isNull);
6166 JUnitTestCase.assertNotNull(functionBody.functionDefinition); 6164 expect(functionBody.functionDefinition, isNotNull);
6167 JUnitTestCase.assertNotNull(functionBody.expression); 6165 expect(functionBody.expression, isNotNull);
6168 JUnitTestCase.assertNotNull(functionBody.semicolon); 6166 expect(functionBody.semicolon, isNotNull);
6169 JUnitTestCase.assertFalse(functionBody.isAsynchronous); 6167 expect(functionBody.isAsynchronous, isFalse);
6170 JUnitTestCase.assertFalse(functionBody.isGenerator); 6168 expect(functionBody.isGenerator, isFalse);
6171 JUnitTestCase.assertTrue(functionBody.isSynchronous); 6169 expect(functionBody.isSynchronous, isTrue);
6172 } 6170 }
6173 6171
6174 void test_parseFunctionBody_expression_async() { 6172 void test_parseFunctionBody_expression_async() {
6175 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "async => y;"); 6173 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "async => y;");
6176 JUnitTestCase.assertNotNull(functionBody.keyword); 6174 expect(functionBody.keyword, isNotNull);
6177 JUnitTestCase.assertEquals(Parser.ASYNC, functionBody.keyword.lexeme); 6175 expect(functionBody.keyword.lexeme, Parser.ASYNC);
6178 JUnitTestCase.assertNotNull(functionBody.functionDefinition); 6176 expect(functionBody.functionDefinition, isNotNull);
6179 JUnitTestCase.assertNotNull(functionBody.expression); 6177 expect(functionBody.expression, isNotNull);
6180 JUnitTestCase.assertNotNull(functionBody.semicolon); 6178 expect(functionBody.semicolon, isNotNull);
6181 JUnitTestCase.assertTrue(functionBody.isAsynchronous); 6179 expect(functionBody.isAsynchronous, isTrue);
6182 JUnitTestCase.assertFalse(functionBody.isGenerator); 6180 expect(functionBody.isGenerator, isFalse);
6183 JUnitTestCase.assertFalse(functionBody.isSynchronous); 6181 expect(functionBody.isSynchronous, isFalse);
6184 } 6182 }
6185 6183
6186 void test_parseFunctionBody_nativeFunctionBody() { 6184 void test_parseFunctionBody_nativeFunctionBody() {
6187 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';"); 6185 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';");
6188 JUnitTestCase.assertNotNull(functionBody.nativeToken); 6186 expect(functionBody.nativeToken, isNotNull);
6189 JUnitTestCase.assertNotNull(functionBody.stringLiteral); 6187 expect(functionBody.stringLiteral, isNotNull);
6190 JUnitTestCase.assertNotNull(functionBody.semicolon); 6188 expect(functionBody.semicolon, isNotNull);
6191 } 6189 }
6192 6190
6193 void test_parseFunctionBody_skip_block() { 6191 void test_parseFunctionBody_skip_block() {
6194 ParserTestCase.parseFunctionBodies = false; 6192 ParserTestCase.parseFunctionBodies = false;
6195 FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Objec t> [false, null, false], "{}"); 6193 FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Objec t> [false, null, false], "{}");
6196 EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunc tionBody, functionBody); 6194 EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunc tionBody, functionBody);
6197 } 6195 }
6198 6196
6199 void test_parseFunctionBody_skip_block_invalid() { 6197 void test_parseFunctionBody_skip_block_invalid() {
6200 ParserTestCase.parseFunctionBodies = false; 6198 ParserTestCase.parseFunctionBodies = false;
(...skipping 10 matching lines...) Expand all
6211 void test_parseFunctionBody_skip_expression() { 6209 void test_parseFunctionBody_skip_expression() {
6212 ParserTestCase.parseFunctionBodies = false; 6210 ParserTestCase.parseFunctionBodies = false;
6213 FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Objec t> [false, null, false], "=> y;"); 6211 FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Objec t> [false, null, false], "=> y;");
6214 EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunc tionBody, functionBody); 6212 EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunc tionBody, functionBody);
6215 } 6213 }
6216 6214
6217 void test_parseFunctionDeclaration_function() { 6215 void test_parseFunctionDeclaration_function() {
6218 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6216 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6219 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6217 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6220 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}"); 6218 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}");
6221 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 6219 expect(declaration.documentationComment, comment);
6222 JUnitTestCase.assertEquals(returnType, declaration.returnType); 6220 expect(declaration.returnType, returnType);
6223 JUnitTestCase.assertNotNull(declaration.name); 6221 expect(declaration.name, isNotNull);
6224 FunctionExpression expression = declaration.functionExpression; 6222 FunctionExpression expression = declaration.functionExpression;
6225 JUnitTestCase.assertNotNull(expression); 6223 expect(expression, isNotNull);
6226 JUnitTestCase.assertNotNull(expression.body); 6224 expect(expression.body, isNotNull);
6227 JUnitTestCase.assertNotNull(expression.parameters); 6225 expect(expression.parameters, isNotNull);
6228 JUnitTestCase.assertNull(declaration.propertyKeyword); 6226 expect(declaration.propertyKeyword, isNull);
6229 } 6227 }
6230 6228
6231 void test_parseFunctionDeclaration_getter() { 6229 void test_parseFunctionDeclaration_getter() {
6232 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6230 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6233 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6231 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6234 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "get p => 0 ;"); 6232 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "get p => 0 ;");
6235 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 6233 expect(declaration.documentationComment, comment);
6236 JUnitTestCase.assertEquals(returnType, declaration.returnType); 6234 expect(declaration.returnType, returnType);
6237 JUnitTestCase.assertNotNull(declaration.name); 6235 expect(declaration.name, isNotNull);
6238 FunctionExpression expression = declaration.functionExpression; 6236 FunctionExpression expression = declaration.functionExpression;
6239 JUnitTestCase.assertNotNull(expression); 6237 expect(expression, isNotNull);
6240 JUnitTestCase.assertNotNull(expression.body); 6238 expect(expression.body, isNotNull);
6241 JUnitTestCase.assertNull(expression.parameters); 6239 expect(expression.parameters, isNull);
6242 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 6240 expect(declaration.propertyKeyword, isNotNull);
6243 } 6241 }
6244 6242
6245 void test_parseFunctionDeclaration_setter() { 6243 void test_parseFunctionDeclaration_setter() {
6246 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6244 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6247 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6245 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6248 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "set p(v) { }"); 6246 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "set p(v) { }");
6249 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 6247 expect(declaration.documentationComment, comment);
6250 JUnitTestCase.assertEquals(returnType, declaration.returnType); 6248 expect(declaration.returnType, returnType);
6251 JUnitTestCase.assertNotNull(declaration.name); 6249 expect(declaration.name, isNotNull);
6252 FunctionExpression expression = declaration.functionExpression; 6250 FunctionExpression expression = declaration.functionExpression;
6253 JUnitTestCase.assertNotNull(expression); 6251 expect(expression, isNotNull);
6254 JUnitTestCase.assertNotNull(expression.body); 6252 expect(expression.body, isNotNull);
6255 JUnitTestCase.assertNotNull(expression.parameters); 6253 expect(expression.parameters, isNotNull);
6256 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 6254 expect(declaration.propertyKeyword, isNotNull);
6257 } 6255 }
6258 6256
6259 void test_parseFunctionDeclarationStatement() { 6257 void test_parseFunctionDeclarationStatement() {
6260 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseFunctio nDeclarationStatement", "void f(int p) => p * 2;", []); 6258 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseFunctio nDeclarationStatement", "void f(int p) => p * 2;", []);
6261 JUnitTestCase.assertNotNull(statement.functionDeclaration); 6259 expect(statement.functionDeclaration, isNotNull);
6262 } 6260 }
6263 6261
6264 void test_parseFunctionExpression_body_inExpression() { 6262 void test_parseFunctionExpression_body_inExpression() {
6265 FunctionExpression expression = ParserTestCase.parse4("parseFunctionExpressi on", "(int i) => i++", []); 6263 FunctionExpression expression = ParserTestCase.parse4("parseFunctionExpressi on", "(int i) => i++", []);
6266 JUnitTestCase.assertNotNull(expression.body); 6264 expect(expression.body, isNotNull);
6267 JUnitTestCase.assertNotNull(expression.parameters); 6265 expect(expression.parameters, isNotNull);
6268 JUnitTestCase.assertNull((expression.body as ExpressionFunctionBody).semicol on); 6266 expect((expression.body as ExpressionFunctionBody).semicolon, isNull);
6269 } 6267 }
6270 6268
6271 void test_parseGetter_nonStatic() { 6269 void test_parseGetter_nonStatic() {
6272 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6270 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6273 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6271 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6274 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "get a;"); 6272 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "get a;");
6275 JUnitTestCase.assertNotNull(method.body); 6273 expect(method.body, isNotNull);
6276 JUnitTestCase.assertEquals(comment, method.documentationComment); 6274 expect(method.documentationComment, comment);
6277 JUnitTestCase.assertNull(method.externalKeyword); 6275 expect(method.externalKeyword, isNull);
6278 JUnitTestCase.assertNull(method.modifierKeyword); 6276 expect(method.modifierKeyword, isNull);
6279 JUnitTestCase.assertNotNull(method.name); 6277 expect(method.name, isNotNull);
6280 JUnitTestCase.assertNull(method.operatorKeyword); 6278 expect(method.operatorKeyword, isNull);
6281 JUnitTestCase.assertNull(method.parameters); 6279 expect(method.parameters, isNull);
6282 JUnitTestCase.assertNotNull(method.propertyKeyword); 6280 expect(method.propertyKeyword, isNotNull);
6283 JUnitTestCase.assertEquals(returnType, method.returnType); 6281 expect(method.returnType, returnType);
6284 } 6282 }
6285 6283
6286 void test_parseGetter_static() { 6284 void test_parseGetter_static() {
6287 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6285 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6288 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 6286 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
6289 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6287 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6290 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [ 6288 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [
6291 commentAndMetadata(comment, []), 6289 commentAndMetadata(comment, []),
6292 null, 6290 null,
6293 staticKeyword, 6291 staticKeyword,
6294 returnType], "get a => 42;"); 6292 returnType], "get a => 42;");
6295 JUnitTestCase.assertNotNull(method.body); 6293 expect(method.body, isNotNull);
6296 JUnitTestCase.assertEquals(comment, method.documentationComment); 6294 expect(method.documentationComment, comment);
6297 JUnitTestCase.assertNull(method.externalKeyword); 6295 expect(method.externalKeyword, isNull);
6298 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 6296 expect(method.modifierKeyword, staticKeyword);
6299 JUnitTestCase.assertNotNull(method.name); 6297 expect(method.name, isNotNull);
6300 JUnitTestCase.assertNull(method.operatorKeyword); 6298 expect(method.operatorKeyword, isNull);
6301 JUnitTestCase.assertNull(method.parameters); 6299 expect(method.parameters, isNull);
6302 JUnitTestCase.assertNotNull(method.propertyKeyword); 6300 expect(method.propertyKeyword, isNotNull);
6303 JUnitTestCase.assertEquals(returnType, method.returnType); 6301 expect(method.returnType, returnType);
6304 } 6302 }
6305 6303
6306 void test_parseIdentifierList_multiple() { 6304 void test_parseIdentifierList_multiple() {
6307 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a, b, c", []); 6305 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a, b, c", []);
6308 EngineTestCase.assertSizeOfList(3, list); 6306 EngineTestCase.assertSizeOfList(3, list);
6309 } 6307 }
6310 6308
6311 void test_parseIdentifierList_single() { 6309 void test_parseIdentifierList_single() {
6312 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a", []); 6310 List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", " a", []);
6313 EngineTestCase.assertSizeOfList(1, list); 6311 EngineTestCase.assertSizeOfList(1, list);
6314 } 6312 }
6315 6313
6316 void test_parseIfStatement_else_block() { 6314 void test_parseIfStatement_else_block() {
6317 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}", []); 6315 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}", []);
6318 JUnitTestCase.assertNotNull(statement.ifKeyword); 6316 expect(statement.ifKeyword, isNotNull);
6319 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6317 expect(statement.leftParenthesis, isNotNull);
6320 JUnitTestCase.assertNotNull(statement.condition); 6318 expect(statement.condition, isNotNull);
6321 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6319 expect(statement.rightParenthesis, isNotNull);
6322 JUnitTestCase.assertNotNull(statement.thenStatement); 6320 expect(statement.thenStatement, isNotNull);
6323 JUnitTestCase.assertNotNull(statement.elseKeyword); 6321 expect(statement.elseKeyword, isNotNull);
6324 JUnitTestCase.assertNotNull(statement.elseStatement); 6322 expect(statement.elseStatement, isNotNull);
6325 } 6323 }
6326 6324
6327 void test_parseIfStatement_else_statement() { 6325 void test_parseIfStatement_else_statement() {
6328 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f( x); else f(y);", []); 6326 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f( x); else f(y);", []);
6329 JUnitTestCase.assertNotNull(statement.ifKeyword); 6327 expect(statement.ifKeyword, isNotNull);
6330 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6328 expect(statement.leftParenthesis, isNotNull);
6331 JUnitTestCase.assertNotNull(statement.condition); 6329 expect(statement.condition, isNotNull);
6332 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6330 expect(statement.rightParenthesis, isNotNull);
6333 JUnitTestCase.assertNotNull(statement.thenStatement); 6331 expect(statement.thenStatement, isNotNull);
6334 JUnitTestCase.assertNotNull(statement.elseKeyword); 6332 expect(statement.elseKeyword, isNotNull);
6335 JUnitTestCase.assertNotNull(statement.elseStatement); 6333 expect(statement.elseStatement, isNotNull);
6336 } 6334 }
6337 6335
6338 void test_parseIfStatement_noElse_block() { 6336 void test_parseIfStatement_noElse_block() {
6339 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} ", []); 6337 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} ", []);
6340 JUnitTestCase.assertNotNull(statement.ifKeyword); 6338 expect(statement.ifKeyword, isNotNull);
6341 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6339 expect(statement.leftParenthesis, isNotNull);
6342 JUnitTestCase.assertNotNull(statement.condition); 6340 expect(statement.condition, isNotNull);
6343 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6341 expect(statement.rightParenthesis, isNotNull);
6344 JUnitTestCase.assertNotNull(statement.thenStatement); 6342 expect(statement.thenStatement, isNotNull);
6345 JUnitTestCase.assertNull(statement.elseKeyword); 6343 expect(statement.elseKeyword, isNull);
6346 JUnitTestCase.assertNull(statement.elseStatement); 6344 expect(statement.elseStatement, isNull);
6347 } 6345 }
6348 6346
6349 void test_parseIfStatement_noElse_statement() { 6347 void test_parseIfStatement_noElse_statement() {
6350 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f( x);", []); 6348 IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f( x);", []);
6351 JUnitTestCase.assertNotNull(statement.ifKeyword); 6349 expect(statement.ifKeyword, isNotNull);
6352 JUnitTestCase.assertNotNull(statement.leftParenthesis); 6350 expect(statement.leftParenthesis, isNotNull);
6353 JUnitTestCase.assertNotNull(statement.condition); 6351 expect(statement.condition, isNotNull);
6354 JUnitTestCase.assertNotNull(statement.rightParenthesis); 6352 expect(statement.rightParenthesis, isNotNull);
6355 JUnitTestCase.assertNotNull(statement.thenStatement); 6353 expect(statement.thenStatement, isNotNull);
6356 JUnitTestCase.assertNull(statement.elseKeyword); 6354 expect(statement.elseKeyword, isNull);
6357 JUnitTestCase.assertNull(statement.elseStatement); 6355 expect(statement.elseStatement, isNull);
6358 } 6356 }
6359 6357
6360 void test_parseImplementsClause_multiple() { 6358 void test_parseImplementsClause_multiple() {
6361 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A, B, C", []); 6359 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A, B, C", []);
6362 EngineTestCase.assertSizeOfList(3, clause.interfaces); 6360 EngineTestCase.assertSizeOfList(3, clause.interfaces);
6363 JUnitTestCase.assertNotNull(clause.keyword); 6361 expect(clause.keyword, isNotNull);
6364 } 6362 }
6365 6363
6366 void test_parseImplementsClause_single() { 6364 void test_parseImplementsClause_single() {
6367 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A", []); 6365 ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "im plements A", []);
6368 EngineTestCase.assertSizeOfList(1, clause.interfaces); 6366 EngineTestCase.assertSizeOfList(1, clause.interfaces);
6369 JUnitTestCase.assertNotNull(clause.keyword); 6367 expect(clause.keyword, isNotNull);
6370 } 6368 }
6371 6369
6372 void test_parseImportDirective_deferred() { 6370 void test_parseImportDirective_deferred() {
6373 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;");
6374 JUnitTestCase.assertNotNull(directive.keyword); 6372 expect(directive.keyword, isNotNull);
6375 JUnitTestCase.assertNotNull(directive.uri); 6373 expect(directive.uri, isNotNull);
6376 JUnitTestCase.assertNotNull(directive.deferredToken); 6374 expect(directive.deferredToken, isNotNull);
6377 JUnitTestCase.assertNotNull(directive.asToken); 6375 expect(directive.asToken, isNotNull);
6378 JUnitTestCase.assertNotNull(directive.prefix); 6376 expect(directive.prefix, isNotNull);
6379 EngineTestCase.assertSizeOfList(0, directive.combinators); 6377 EngineTestCase.assertSizeOfList(0, directive.combinators);
6380 JUnitTestCase.assertNotNull(directive.semicolon); 6378 expect(directive.semicolon, isNotNull);
6381 } 6379 }
6382 6380
6383 void test_parseImportDirective_hide() { 6381 void test_parseImportDirective_hide() {
6384 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;");
6385 JUnitTestCase.assertNotNull(directive.keyword); 6383 expect(directive.keyword, isNotNull);
6386 JUnitTestCase.assertNotNull(directive.uri); 6384 expect(directive.uri, isNotNull);
6387 JUnitTestCase.assertNull(directive.deferredToken); 6385 expect(directive.deferredToken, isNull);
6388 JUnitTestCase.assertNull(directive.asToken); 6386 expect(directive.asToken, isNull);
6389 JUnitTestCase.assertNull(directive.prefix); 6387 expect(directive.prefix, isNull);
6390 EngineTestCase.assertSizeOfList(1, directive.combinators); 6388 EngineTestCase.assertSizeOfList(1, directive.combinators);
6391 JUnitTestCase.assertNotNull(directive.semicolon); 6389 expect(directive.semicolon, isNotNull);
6392 } 6390 }
6393 6391
6394 void test_parseImportDirective_noCombinator() { 6392 void test_parseImportDirective_noCombinator() {
6395 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';");
6396 JUnitTestCase.assertNotNull(directive.keyword); 6394 expect(directive.keyword, isNotNull);
6397 JUnitTestCase.assertNotNull(directive.uri); 6395 expect(directive.uri, isNotNull);
6398 JUnitTestCase.assertNull(directive.deferredToken); 6396 expect(directive.deferredToken, isNull);
6399 JUnitTestCase.assertNull(directive.asToken); 6397 expect(directive.asToken, isNull);
6400 JUnitTestCase.assertNull(directive.prefix); 6398 expect(directive.prefix, isNull);
6401 EngineTestCase.assertSizeOfList(0, directive.combinators); 6399 EngineTestCase.assertSizeOfList(0, directive.combinators);
6402 JUnitTestCase.assertNotNull(directive.semicolon); 6400 expect(directive.semicolon, isNotNull);
6403 } 6401 }
6404 6402
6405 void test_parseImportDirective_prefix() { 6403 void test_parseImportDirective_prefix() {
6406 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;");
6407 JUnitTestCase.assertNotNull(directive.keyword); 6405 expect(directive.keyword, isNotNull);
6408 JUnitTestCase.assertNotNull(directive.uri); 6406 expect(directive.uri, isNotNull);
6409 JUnitTestCase.assertNull(directive.deferredToken); 6407 expect(directive.deferredToken, isNull);
6410 JUnitTestCase.assertNotNull(directive.asToken); 6408 expect(directive.asToken, isNotNull);
6411 JUnitTestCase.assertNotNull(directive.prefix); 6409 expect(directive.prefix, isNotNull);
6412 EngineTestCase.assertSizeOfList(0, directive.combinators); 6410 EngineTestCase.assertSizeOfList(0, directive.combinators);
6413 JUnitTestCase.assertNotNull(directive.semicolon); 6411 expect(directive.semicolon, isNotNull);
6414 } 6412 }
6415 6413
6416 void test_parseImportDirective_prefix_hide_show() { 6414 void test_parseImportDirective_prefix_hide_show() {
6417 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;");
6418 JUnitTestCase.assertNotNull(directive.keyword); 6416 expect(directive.keyword, isNotNull);
6419 JUnitTestCase.assertNotNull(directive.uri); 6417 expect(directive.uri, isNotNull);
6420 JUnitTestCase.assertNull(directive.deferredToken); 6418 expect(directive.deferredToken, isNull);
6421 JUnitTestCase.assertNotNull(directive.asToken); 6419 expect(directive.asToken, isNotNull);
6422 JUnitTestCase.assertNotNull(directive.prefix); 6420 expect(directive.prefix, isNotNull);
6423 EngineTestCase.assertSizeOfList(2, directive.combinators); 6421 EngineTestCase.assertSizeOfList(2, directive.combinators);
6424 JUnitTestCase.assertNotNull(directive.semicolon); 6422 expect(directive.semicolon, isNotNull);
6425 } 6423 }
6426 6424
6427 void test_parseImportDirective_prefix_show_hide() { 6425 void test_parseImportDirective_prefix_show_hide() {
6428 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;");
6429 JUnitTestCase.assertNotNull(directive.keyword); 6427 expect(directive.keyword, isNotNull);
6430 JUnitTestCase.assertNotNull(directive.uri); 6428 expect(directive.uri, isNotNull);
6431 JUnitTestCase.assertNull(directive.deferredToken); 6429 expect(directive.deferredToken, isNull);
6432 JUnitTestCase.assertNotNull(directive.asToken); 6430 expect(directive.asToken, isNotNull);
6433 JUnitTestCase.assertNotNull(directive.prefix); 6431 expect(directive.prefix, isNotNull);
6434 EngineTestCase.assertSizeOfList(2, directive.combinators); 6432 EngineTestCase.assertSizeOfList(2, directive.combinators);
6435 JUnitTestCase.assertNotNull(directive.semicolon); 6433 expect(directive.semicolon, isNotNull);
6436 } 6434 }
6437 6435
6438 void test_parseImportDirective_show() { 6436 void test_parseImportDirective_show() {
6439 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;");
6440 JUnitTestCase.assertNotNull(directive.keyword); 6438 expect(directive.keyword, isNotNull);
6441 JUnitTestCase.assertNotNull(directive.uri); 6439 expect(directive.uri, isNotNull);
6442 JUnitTestCase.assertNull(directive.deferredToken); 6440 expect(directive.deferredToken, isNull);
6443 JUnitTestCase.assertNull(directive.asToken); 6441 expect(directive.asToken, isNull);
6444 JUnitTestCase.assertNull(directive.prefix); 6442 expect(directive.prefix, isNull);
6445 EngineTestCase.assertSizeOfList(1, directive.combinators); 6443 EngineTestCase.assertSizeOfList(1, directive.combinators);
6446 JUnitTestCase.assertNotNull(directive.semicolon); 6444 expect(directive.semicolon, isNotNull);
6447 } 6445 }
6448 6446
6449 void test_parseInitializedIdentifierList_type() { 6447 void test_parseInitializedIdentifierList_type() {
6450 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6448 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6451 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 6449 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
6452 TypeName type = new TypeName(new SimpleIdentifier(null), null); 6450 TypeName type = new TypeName(new SimpleIdentifier(null), null);
6453 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 6451 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
6454 commentAndMetadata(comment, []), 6452 commentAndMetadata(comment, []),
6455 staticKeyword, 6453 staticKeyword,
6456 null, 6454 null,
6457 type], "a = 1, b, c = 3;"); 6455 type], "a = 1, b, c = 3;");
6458 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 6456 expect(declaration.documentationComment, comment);
6459 VariableDeclarationList fields = declaration.fields; 6457 VariableDeclarationList fields = declaration.fields;
6460 JUnitTestCase.assertNotNull(fields); 6458 expect(fields, isNotNull);
6461 JUnitTestCase.assertNull(fields.keyword); 6459 expect(fields.keyword, isNull);
6462 JUnitTestCase.assertEquals(type, fields.type); 6460 expect(fields.type, type);
6463 EngineTestCase.assertSizeOfList(3, fields.variables); 6461 EngineTestCase.assertSizeOfList(3, fields.variables);
6464 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); 6462 expect(declaration.staticKeyword, staticKeyword);
6465 JUnitTestCase.assertNotNull(declaration.semicolon); 6463 expect(declaration.semicolon, isNotNull);
6466 } 6464 }
6467 6465
6468 void test_parseInitializedIdentifierList_var() { 6466 void test_parseInitializedIdentifierList_var() {
6469 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6467 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6470 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 6468 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
6471 Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR); 6469 Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
6472 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 6470 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
6473 commentAndMetadata(comment, []), 6471 commentAndMetadata(comment, []),
6474 staticKeyword, 6472 staticKeyword,
6475 varKeyword, 6473 varKeyword,
6476 null], "a = 1, b, c = 3;"); 6474 null], "a = 1, b, c = 3;");
6477 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 6475 expect(declaration.documentationComment, comment);
6478 VariableDeclarationList fields = declaration.fields; 6476 VariableDeclarationList fields = declaration.fields;
6479 JUnitTestCase.assertNotNull(fields); 6477 expect(fields, isNotNull);
6480 JUnitTestCase.assertEquals(varKeyword, fields.keyword); 6478 expect(fields.keyword, varKeyword);
6481 JUnitTestCase.assertNull(fields.type); 6479 expect(fields.type, isNull);
6482 EngineTestCase.assertSizeOfList(3, fields.variables); 6480 EngineTestCase.assertSizeOfList(3, fields.variables);
6483 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); 6481 expect(declaration.staticKeyword, staticKeyword);
6484 JUnitTestCase.assertNotNull(declaration.semicolon); 6482 expect(declaration.semicolon, isNotNull);
6485 } 6483 }
6486 6484
6487 void test_parseInstanceCreationExpression_qualifiedType() { 6485 void test_parseInstanceCreationExpression_qualifiedType() {
6488 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); 6486 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
6489 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()"); 6487 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()");
6490 JUnitTestCase.assertEquals(token, expression.keyword); 6488 expect(expression.keyword, token);
6491 ConstructorName name = expression.constructorName; 6489 ConstructorName name = expression.constructorName;
6492 JUnitTestCase.assertNotNull(name); 6490 expect(name, isNotNull);
6493 JUnitTestCase.assertNotNull(name.type); 6491 expect(name.type, isNotNull);
6494 JUnitTestCase.assertNull(name.period); 6492 expect(name.period, isNull);
6495 JUnitTestCase.assertNull(name.name); 6493 expect(name.name, isNull);
6496 JUnitTestCase.assertNotNull(expression.argumentList); 6494 expect(expression.argumentList, isNotNull);
6497 } 6495 }
6498 6496
6499 void test_parseInstanceCreationExpression_qualifiedType_named() { 6497 void test_parseInstanceCreationExpression_qualifiedType_named() {
6500 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); 6498 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
6501 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B.c()"); 6499 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B.c()");
6502 JUnitTestCase.assertEquals(token, expression.keyword); 6500 expect(expression.keyword, token);
6503 ConstructorName name = expression.constructorName; 6501 ConstructorName name = expression.constructorName;
6504 JUnitTestCase.assertNotNull(name); 6502 expect(name, isNotNull);
6505 JUnitTestCase.assertNotNull(name.type); 6503 expect(name.type, isNotNull);
6506 JUnitTestCase.assertNotNull(name.period); 6504 expect(name.period, isNotNull);
6507 JUnitTestCase.assertNotNull(name.name); 6505 expect(name.name, isNotNull);
6508 JUnitTestCase.assertNotNull(expression.argumentList); 6506 expect(expression.argumentList, isNotNull);
6509 } 6507 }
6510 6508
6511 void test_parseInstanceCreationExpression_type() { 6509 void test_parseInstanceCreationExpression_type() {
6512 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); 6510 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
6513 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A()"); 6511 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A()");
6514 JUnitTestCase.assertEquals(token, expression.keyword); 6512 expect(expression.keyword, token);
6515 ConstructorName name = expression.constructorName; 6513 ConstructorName name = expression.constructorName;
6516 JUnitTestCase.assertNotNull(name); 6514 expect(name, isNotNull);
6517 JUnitTestCase.assertNotNull(name.type); 6515 expect(name.type, isNotNull);
6518 JUnitTestCase.assertNull(name.period); 6516 expect(name.period, isNull);
6519 JUnitTestCase.assertNull(name.name); 6517 expect(name.name, isNull);
6520 JUnitTestCase.assertNotNull(expression.argumentList); 6518 expect(expression.argumentList, isNotNull);
6521 } 6519 }
6522 6520
6523 void test_parseInstanceCreationExpression_type_named() { 6521 void test_parseInstanceCreationExpression_type_named() {
6524 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); 6522 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
6525 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A<B>.c()"); 6523 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A<B>.c()");
6526 JUnitTestCase.assertEquals(token, expression.keyword); 6524 expect(expression.keyword, token);
6527 ConstructorName name = expression.constructorName; 6525 ConstructorName name = expression.constructorName;
6528 JUnitTestCase.assertNotNull(name); 6526 expect(name, isNotNull);
6529 JUnitTestCase.assertNotNull(name.type); 6527 expect(name.type, isNotNull);
6530 JUnitTestCase.assertNotNull(name.period); 6528 expect(name.period, isNotNull);
6531 JUnitTestCase.assertNotNull(name.name); 6529 expect(name.name, isNotNull);
6532 JUnitTestCase.assertNotNull(expression.argumentList); 6530 expect(expression.argumentList, isNotNull);
6533 } 6531 }
6534 6532
6535 void test_parseLibraryDirective() { 6533 void test_parseLibraryDirective() {
6536 LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective", < Object> [emptyCommentAndMetadata()], "library l;"); 6534 LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective", < Object> [emptyCommentAndMetadata()], "library l;");
6537 JUnitTestCase.assertNotNull(directive.libraryToken); 6535 expect(directive.libraryToken, isNotNull);
6538 JUnitTestCase.assertNotNull(directive.name); 6536 expect(directive.name, isNotNull);
6539 JUnitTestCase.assertNotNull(directive.semicolon); 6537 expect(directive.semicolon, isNotNull);
6540 } 6538 }
6541 6539
6542 void test_parseLibraryIdentifier_multiple() { 6540 void test_parseLibraryIdentifier_multiple() {
6543 String name = "a.b.c"; 6541 String name = "a.b.c";
6544 LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier ", name, []); 6542 LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier ", name, []);
6545 JUnitTestCase.assertEquals(name, identifier.name); 6543 expect(identifier.name, name);
6546 } 6544 }
6547 6545
6548 void test_parseLibraryIdentifier_single() { 6546 void test_parseLibraryIdentifier_single() {
6549 String name = "a"; 6547 String name = "a";
6550 LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier ", name, []); 6548 LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier ", name, []);
6551 JUnitTestCase.assertEquals(name, identifier.name); 6549 expect(identifier.name, name);
6552 } 6550 }
6553 6551
6554 void test_parseListLiteral_empty_oneToken() { 6552 void test_parseListLiteral_empty_oneToken() {
6555 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6553 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6556 TypeArgumentList typeArguments = null; 6554 TypeArgumentList typeArguments = null;
6557 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]"); 6555 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]");
6558 JUnitTestCase.assertEquals(token, literal.constKeyword); 6556 expect(literal.constKeyword, token);
6559 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 6557 expect(literal.typeArguments, typeArguments);
6560 JUnitTestCase.assertNotNull(literal.leftBracket); 6558 expect(literal.leftBracket, isNotNull);
6561 EngineTestCase.assertSizeOfList(0, literal.elements); 6559 EngineTestCase.assertSizeOfList(0, literal.elements);
6562 JUnitTestCase.assertNotNull(literal.rightBracket); 6560 expect(literal.rightBracket, isNotNull);
6563 } 6561 }
6564 6562
6565 void test_parseListLiteral_empty_twoTokens() { 6563 void test_parseListLiteral_empty_twoTokens() {
6566 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6564 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6567 TypeArgumentList typeArguments = null; 6565 TypeArgumentList typeArguments = null;
6568 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]"); 6566 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]");
6569 JUnitTestCase.assertEquals(token, literal.constKeyword); 6567 expect(literal.constKeyword, token);
6570 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 6568 expect(literal.typeArguments, typeArguments);
6571 JUnitTestCase.assertNotNull(literal.leftBracket); 6569 expect(literal.leftBracket, isNotNull);
6572 EngineTestCase.assertSizeOfList(0, literal.elements); 6570 EngineTestCase.assertSizeOfList(0, literal.elements);
6573 JUnitTestCase.assertNotNull(literal.rightBracket); 6571 expect(literal.rightBracket, isNotNull);
6574 } 6572 }
6575 6573
6576 void test_parseListLiteral_multiple() { 6574 void test_parseListLiteral_multiple() {
6577 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]");
6578 JUnitTestCase.assertNull(literal.constKeyword); 6576 expect(literal.constKeyword, isNull);
6579 JUnitTestCase.assertNull(literal.typeArguments); 6577 expect(literal.typeArguments, isNull);
6580 JUnitTestCase.assertNotNull(literal.leftBracket); 6578 expect(literal.leftBracket, isNotNull);
6581 EngineTestCase.assertSizeOfList(3, literal.elements); 6579 EngineTestCase.assertSizeOfList(3, literal.elements);
6582 JUnitTestCase.assertNotNull(literal.rightBracket); 6580 expect(literal.rightBracket, isNotNull);
6583 } 6581 }
6584 6582
6585 void test_parseListLiteral_single() { 6583 void test_parseListLiteral_single() {
6586 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]"); 6584 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]");
6587 JUnitTestCase.assertNull(literal.constKeyword); 6585 expect(literal.constKeyword, isNull);
6588 JUnitTestCase.assertNull(literal.typeArguments); 6586 expect(literal.typeArguments, isNull);
6589 JUnitTestCase.assertNotNull(literal.leftBracket); 6587 expect(literal.leftBracket, isNotNull);
6590 EngineTestCase.assertSizeOfList(1, literal.elements); 6588 EngineTestCase.assertSizeOfList(1, literal.elements);
6591 JUnitTestCase.assertNotNull(literal.rightBracket); 6589 expect(literal.rightBracket, isNotNull);
6592 } 6590 }
6593 6591
6594 void test_parseListOrMapLiteral_list_noType() { 6592 void test_parseListOrMapLiteral_list_noType() {
6595 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]"); 6593 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]");
6596 JUnitTestCase.assertNull(literal.constKeyword); 6594 expect(literal.constKeyword, isNull);
6597 JUnitTestCase.assertNull(literal.typeArguments); 6595 expect(literal.typeArguments, isNull);
6598 JUnitTestCase.assertNotNull(literal.leftBracket); 6596 expect(literal.leftBracket, isNotNull);
6599 EngineTestCase.assertSizeOfList(1, literal.elements); 6597 EngineTestCase.assertSizeOfList(1, literal.elements);
6600 JUnitTestCase.assertNotNull(literal.rightBracket); 6598 expect(literal.rightBracket, isNotNull);
6601 } 6599 }
6602 6600
6603 void test_parseListOrMapLiteral_list_type() { 6601 void test_parseListOrMapLiteral_list_type() {
6604 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]"); 6602 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]");
6605 JUnitTestCase.assertNull(literal.constKeyword); 6603 expect(literal.constKeyword, isNull);
6606 JUnitTestCase.assertNotNull(literal.typeArguments); 6604 expect(literal.typeArguments, isNotNull);
6607 JUnitTestCase.assertNotNull(literal.leftBracket); 6605 expect(literal.leftBracket, isNotNull);
6608 EngineTestCase.assertSizeOfList(1, literal.elements); 6606 EngineTestCase.assertSizeOfList(1, literal.elements);
6609 JUnitTestCase.assertNotNull(literal.rightBracket); 6607 expect(literal.rightBracket, isNotNull);
6610 } 6608 }
6611 6609
6612 void test_parseListOrMapLiteral_map_noType() { 6610 void test_parseListOrMapLiteral_map_noType() {
6613 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}"); 6611 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
6614 JUnitTestCase.assertNull(literal.constKeyword); 6612 expect(literal.constKeyword, isNull);
6615 JUnitTestCase.assertNull(literal.typeArguments); 6613 expect(literal.typeArguments, isNull);
6616 JUnitTestCase.assertNotNull(literal.leftBracket); 6614 expect(literal.leftBracket, isNotNull);
6617 EngineTestCase.assertSizeOfList(1, literal.entries); 6615 EngineTestCase.assertSizeOfList(1, literal.entries);
6618 JUnitTestCase.assertNotNull(literal.rightBracket); 6616 expect(literal.rightBracket, isNotNull);
6619 } 6617 }
6620 6618
6621 void test_parseListOrMapLiteral_map_type() { 6619 void test_parseListOrMapLiteral_map_type() {
6622 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}"); 6620 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
6623 JUnitTestCase.assertNull(literal.constKeyword); 6621 expect(literal.constKeyword, isNull);
6624 JUnitTestCase.assertNotNull(literal.typeArguments); 6622 expect(literal.typeArguments, isNotNull);
6625 JUnitTestCase.assertNotNull(literal.leftBracket); 6623 expect(literal.leftBracket, isNotNull);
6626 EngineTestCase.assertSizeOfList(1, literal.entries); 6624 EngineTestCase.assertSizeOfList(1, literal.entries);
6627 JUnitTestCase.assertNotNull(literal.rightBracket); 6625 expect(literal.rightBracket, isNotNull);
6628 } 6626 }
6629 6627
6630 void test_parseLogicalAndExpression() { 6628 void test_parseLogicalAndExpression() {
6631 BinaryExpression expression = ParserTestCase.parse4("parseLogicalAndExpressi on", "x && y", []); 6629 BinaryExpression expression = ParserTestCase.parse4("parseLogicalAndExpressi on", "x && y", []);
6632 JUnitTestCase.assertNotNull(expression.leftOperand); 6630 expect(expression.leftOperand, isNotNull);
6633 JUnitTestCase.assertNotNull(expression.operator); 6631 expect(expression.operator, isNotNull);
6634 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato r.type); 6632 expect(expression.operator.type, TokenType.AMPERSAND_AMPERSAND);
6635 JUnitTestCase.assertNotNull(expression.rightOperand); 6633 expect(expression.rightOperand, isNotNull);
6636 } 6634 }
6637 6635
6638 void test_parseLogicalOrExpression() { 6636 void test_parseLogicalOrExpression() {
6639 BinaryExpression expression = ParserTestCase.parse4("parseLogicalOrExpressio n", "x || y", []); 6637 BinaryExpression expression = ParserTestCase.parse4("parseLogicalOrExpressio n", "x || y", []);
6640 JUnitTestCase.assertNotNull(expression.leftOperand); 6638 expect(expression.leftOperand, isNotNull);
6641 JUnitTestCase.assertNotNull(expression.operator); 6639 expect(expression.operator, isNotNull);
6642 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); 6640 expect(expression.operator.type, TokenType.BAR_BAR);
6643 JUnitTestCase.assertNotNull(expression.rightOperand); 6641 expect(expression.rightOperand, isNotNull);
6644 } 6642 }
6645 6643
6646 void test_parseMapLiteral_empty() { 6644 void test_parseMapLiteral_empty() {
6647 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); 6645 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
6648 TypeArgumentList typeArguments = AstFactory.typeArgumentList([ 6646 TypeArgumentList typeArguments = AstFactory.typeArgumentList([
6649 AstFactory.typeName4("String", []), 6647 AstFactory.typeName4("String", []),
6650 AstFactory.typeName4("int", [])]); 6648 AstFactory.typeName4("int", [])]);
6651 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}"); 6649 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}");
6652 JUnitTestCase.assertEquals(token, literal.constKeyword); 6650 expect(literal.constKeyword, token);
6653 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 6651 expect(literal.typeArguments, typeArguments);
6654 JUnitTestCase.assertNotNull(literal.leftBracket); 6652 expect(literal.leftBracket, isNotNull);
6655 EngineTestCase.assertSizeOfList(0, literal.entries); 6653 EngineTestCase.assertSizeOfList(0, literal.entries);
6656 JUnitTestCase.assertNotNull(literal.rightBracket); 6654 expect(literal.rightBracket, isNotNull);
6657 } 6655 }
6658 6656
6659 void test_parseMapLiteral_multiple() { 6657 void test_parseMapLiteral_multiple() {
6660 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}");
6661 JUnitTestCase.assertNotNull(literal.leftBracket); 6659 expect(literal.leftBracket, isNotNull);
6662 EngineTestCase.assertSizeOfList(2, literal.entries); 6660 EngineTestCase.assertSizeOfList(2, literal.entries);
6663 JUnitTestCase.assertNotNull(literal.rightBracket); 6661 expect(literal.rightBracket, isNotNull);
6664 } 6662 }
6665 6663
6666 void test_parseMapLiteral_single() { 6664 void test_parseMapLiteral_single() {
6667 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}"); 6665 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}");
6668 JUnitTestCase.assertNotNull(literal.leftBracket); 6666 expect(literal.leftBracket, isNotNull);
6669 EngineTestCase.assertSizeOfList(1, literal.entries); 6667 EngineTestCase.assertSizeOfList(1, literal.entries);
6670 JUnitTestCase.assertNotNull(literal.rightBracket); 6668 expect(literal.rightBracket, isNotNull);
6671 } 6669 }
6672 6670
6673 void test_parseMapLiteralEntry_complex() { 6671 void test_parseMapLiteralEntry_complex() {
6674 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "2 + 2 : y", []); 6672 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "2 + 2 : y", []);
6675 JUnitTestCase.assertNotNull(entry.key); 6673 expect(entry.key, isNotNull);
6676 JUnitTestCase.assertNotNull(entry.separator); 6674 expect(entry.separator, isNotNull);
6677 JUnitTestCase.assertNotNull(entry.value); 6675 expect(entry.value, isNotNull);
6678 } 6676 }
6679 6677
6680 void test_parseMapLiteralEntry_int() { 6678 void test_parseMapLiteralEntry_int() {
6681 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "0 : y ", []); 6679 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "0 : y ", []);
6682 JUnitTestCase.assertNotNull(entry.key); 6680 expect(entry.key, isNotNull);
6683 JUnitTestCase.assertNotNull(entry.separator); 6681 expect(entry.separator, isNotNull);
6684 JUnitTestCase.assertNotNull(entry.value); 6682 expect(entry.value, isNotNull);
6685 } 6683 }
6686 6684
6687 void test_parseMapLiteralEntry_string() { 6685 void test_parseMapLiteralEntry_string() {
6688 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "'x' : y", []); 6686 MapLiteralEntry entry = ParserTestCase.parse4("parseMapLiteralEntry", "'x' : y", []);
6689 JUnitTestCase.assertNotNull(entry.key); 6687 expect(entry.key, isNotNull);
6690 JUnitTestCase.assertNotNull(entry.separator); 6688 expect(entry.separator, isNotNull);
6691 JUnitTestCase.assertNotNull(entry.value); 6689 expect(entry.value, isNotNull);
6692 } 6690 }
6693 6691
6694 void test_parseModifiers_abstract() { 6692 void test_parseModifiers_abstract() {
6695 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "abstract A", []); 6693 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "abstract A", []);
6696 JUnitTestCase.assertNotNull(modifiers.abstractKeyword); 6694 expect(modifiers.abstractKeyword, isNotNull);
6697 } 6695 }
6698 6696
6699 void test_parseModifiers_const() { 6697 void test_parseModifiers_const() {
6700 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "const A", []) ; 6698 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "const A", []) ;
6701 JUnitTestCase.assertNotNull(modifiers.constKeyword); 6699 expect(modifiers.constKeyword, isNotNull);
6702 } 6700 }
6703 6701
6704 void test_parseModifiers_external() { 6702 void test_parseModifiers_external() {
6705 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "external A", []); 6703 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "external A", []);
6706 JUnitTestCase.assertNotNull(modifiers.externalKeyword); 6704 expect(modifiers.externalKeyword, isNotNull);
6707 } 6705 }
6708 6706
6709 void test_parseModifiers_factory() { 6707 void test_parseModifiers_factory() {
6710 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "factory A", [ ]); 6708 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "factory A", [ ]);
6711 JUnitTestCase.assertNotNull(modifiers.factoryKeyword); 6709 expect(modifiers.factoryKeyword, isNotNull);
6712 } 6710 }
6713 6711
6714 void test_parseModifiers_final() { 6712 void test_parseModifiers_final() {
6715 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "final A", []) ; 6713 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "final A", []) ;
6716 JUnitTestCase.assertNotNull(modifiers.finalKeyword); 6714 expect(modifiers.finalKeyword, isNotNull);
6717 } 6715 }
6718 6716
6719 void test_parseModifiers_static() { 6717 void test_parseModifiers_static() {
6720 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "static A", [] ); 6718 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "static A", [] );
6721 JUnitTestCase.assertNotNull(modifiers.staticKeyword); 6719 expect(modifiers.staticKeyword, isNotNull);
6722 } 6720 }
6723 6721
6724 void test_parseModifiers_var() { 6722 void test_parseModifiers_var() {
6725 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "var A", []); 6723 Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "var A", []);
6726 JUnitTestCase.assertNotNull(modifiers.varKeyword); 6724 expect(modifiers.varKeyword, isNotNull);
6727 } 6725 }
6728 6726
6729 void test_parseMultiplicativeExpression_normal() { 6727 void test_parseMultiplicativeExpression_normal() {
6730 BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpr ession", "x * y", []); 6728 BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpr ession", "x * y", []);
6731 JUnitTestCase.assertNotNull(expression.leftOperand); 6729 expect(expression.leftOperand, isNotNull);
6732 JUnitTestCase.assertNotNull(expression.operator); 6730 expect(expression.operator, isNotNull);
6733 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type); 6731 expect(expression.operator.type, TokenType.STAR);
6734 JUnitTestCase.assertNotNull(expression.rightOperand); 6732 expect(expression.rightOperand, isNotNull);
6735 } 6733 }
6736 6734
6737 void test_parseMultiplicativeExpression_super() { 6735 void test_parseMultiplicativeExpression_super() {
6738 BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpr ession", "super * y", []); 6736 BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpr ession", "super * y", []);
6739 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand); 6737 EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpres sion, expression.leftOperand);
6740 JUnitTestCase.assertNotNull(expression.operator); 6738 expect(expression.operator, isNotNull);
6741 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type); 6739 expect(expression.operator.type, TokenType.STAR);
6742 JUnitTestCase.assertNotNull(expression.rightOperand); 6740 expect(expression.rightOperand, isNotNull);
6743 } 6741 }
6744 6742
6745 void test_parseNewExpression() { 6743 void test_parseNewExpression() {
6746 InstanceCreationExpression expression = ParserTestCase.parse4("parseNewExpre ssion", "new A()", []); 6744 InstanceCreationExpression expression = ParserTestCase.parse4("parseNewExpre ssion", "new A()", []);
6747 JUnitTestCase.assertNotNull(expression.keyword); 6745 expect(expression.keyword, isNotNull);
6748 ConstructorName name = expression.constructorName; 6746 ConstructorName name = expression.constructorName;
6749 JUnitTestCase.assertNotNull(name); 6747 expect(name, isNotNull);
6750 JUnitTestCase.assertNotNull(name.type); 6748 expect(name.type, isNotNull);
6751 JUnitTestCase.assertNull(name.period); 6749 expect(name.period, isNull);
6752 JUnitTestCase.assertNull(name.name); 6750 expect(name.name, isNull);
6753 JUnitTestCase.assertNotNull(expression.argumentList); 6751 expect(expression.argumentList, isNotNull);
6754 } 6752 }
6755 6753
6756 void test_parseNonLabeledStatement_const_list_empty() { 6754 void test_parseNonLabeledStatement_const_list_empty() {
6757 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const [];", []); 6755 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const [];", []);
6758 JUnitTestCase.assertNotNull(statement.expression); 6756 expect(statement.expression, isNotNull);
6759 } 6757 }
6760 6758
6761 void test_parseNonLabeledStatement_const_list_nonEmpty() { 6759 void test_parseNonLabeledStatement_const_list_nonEmpty() {
6762 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const [1, 2];", []); 6760 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const [1, 2];", []);
6763 JUnitTestCase.assertNotNull(statement.expression); 6761 expect(statement.expression, isNotNull);
6764 } 6762 }
6765 6763
6766 void test_parseNonLabeledStatement_const_map_empty() { 6764 void test_parseNonLabeledStatement_const_map_empty() {
6767 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const {};", []); 6765 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const {};", []);
6768 JUnitTestCase.assertNotNull(statement.expression); 6766 expect(statement.expression, isNotNull);
6769 } 6767 }
6770 6768
6771 void test_parseNonLabeledStatement_const_map_nonEmpty() { 6769 void test_parseNonLabeledStatement_const_map_nonEmpty() {
6772 // TODO(brianwilkerson) Implement more tests for this method. 6770 // TODO(brianwilkerson) Implement more tests for this method.
6773 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const {'a' : 1};", []); 6771 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const {'a' : 1};", []);
6774 JUnitTestCase.assertNotNull(statement.expression); 6772 expect(statement.expression, isNotNull);
6775 } 6773 }
6776 6774
6777 void test_parseNonLabeledStatement_const_object() { 6775 void test_parseNonLabeledStatement_const_object() {
6778 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const A();", []); 6776 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const A();", []);
6779 JUnitTestCase.assertNotNull(statement.expression); 6777 expect(statement.expression, isNotNull);
6780 } 6778 }
6781 6779
6782 void test_parseNonLabeledStatement_const_object_named_typeParameters() { 6780 void test_parseNonLabeledStatement_const_object_named_typeParameters() {
6783 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const A<B>.c();", []); 6781 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "const A<B>.c();", []);
6784 JUnitTestCase.assertNotNull(statement.expression); 6782 expect(statement.expression, isNotNull);
6785 } 6783 }
6786 6784
6787 void test_parseNonLabeledStatement_constructorInvocation() { 6785 void test_parseNonLabeledStatement_constructorInvocation() {
6788 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "new C().m();", []); 6786 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "new C().m();", []);
6789 JUnitTestCase.assertNotNull(statement.expression); 6787 expect(statement.expression, isNotNull);
6790 } 6788 }
6791 6789
6792 void test_parseNonLabeledStatement_false() { 6790 void test_parseNonLabeledStatement_false() {
6793 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "false;", []); 6791 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "false;", []);
6794 JUnitTestCase.assertNotNull(statement.expression); 6792 expect(statement.expression, isNotNull);
6795 } 6793 }
6796 6794
6797 void test_parseNonLabeledStatement_functionDeclaration() { 6795 void test_parseNonLabeledStatement_functionDeclaration() {
6798 ParserTestCase.parse4("parseNonLabeledStatement", "f() {};", []); 6796 ParserTestCase.parse4("parseNonLabeledStatement", "f() {};", []);
6799 } 6797 }
6800 6798
6801 void test_parseNonLabeledStatement_functionDeclaration_arguments() { 6799 void test_parseNonLabeledStatement_functionDeclaration_arguments() {
6802 ParserTestCase.parse4("parseNonLabeledStatement", "f(void g()) {};", []); 6800 ParserTestCase.parse4("parseNonLabeledStatement", "f(void g()) {};", []);
6803 } 6801 }
6804 6802
6805 void test_parseNonLabeledStatement_functionExpressionIndex() { 6803 void test_parseNonLabeledStatement_functionExpressionIndex() {
6806 ParserTestCase.parse4("parseNonLabeledStatement", "() {}[0] = null;", []); 6804 ParserTestCase.parse4("parseNonLabeledStatement", "() {}[0] = null;", []);
6807 } 6805 }
6808 6806
6809 void test_parseNonLabeledStatement_functionInvocation() { 6807 void test_parseNonLabeledStatement_functionInvocation() {
6810 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "f();", []); 6808 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "f();", []);
6811 JUnitTestCase.assertNotNull(statement.expression); 6809 expect(statement.expression, isNotNull);
6812 } 6810 }
6813 6811
6814 void test_parseNonLabeledStatement_invokeFunctionExpression() { 6812 void test_parseNonLabeledStatement_invokeFunctionExpression() {
6815 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []); 6813 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []);
6816 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation , FunctionExpressionInvocation, statement.expression); 6814 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation , FunctionExpressionInvocation, statement.expression);
6817 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation; 6815 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation;
6818 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function); 6816 EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, Function Expression, invocation.function);
6819 FunctionExpression expression = invocation.function as FunctionExpression; 6817 FunctionExpression expression = invocation.function as FunctionExpression;
6820 JUnitTestCase.assertNotNull(expression.parameters); 6818 expect(expression.parameters, isNotNull);
6821 JUnitTestCase.assertNotNull(expression.body); 6819 expect(expression.body, isNotNull);
6822 ArgumentList list = invocation.argumentList; 6820 ArgumentList list = invocation.argumentList;
6823 JUnitTestCase.assertNotNull(list); 6821 expect(list, isNotNull);
6824 EngineTestCase.assertSizeOfList(1, list.arguments); 6822 EngineTestCase.assertSizeOfList(1, list.arguments);
6825 } 6823 }
6826 6824
6827 void test_parseNonLabeledStatement_null() { 6825 void test_parseNonLabeledStatement_null() {
6828 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "null;", []); 6826 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "null;", []);
6829 JUnitTestCase.assertNotNull(statement.expression); 6827 expect(statement.expression, isNotNull);
6830 } 6828 }
6831 6829
6832 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() { 6830 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
6833 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "library.getName();", []); 6831 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "library.getName();", []);
6834 JUnitTestCase.assertNotNull(statement.expression); 6832 expect(statement.expression, isNotNull);
6835 } 6833 }
6836 6834
6837 void test_parseNonLabeledStatement_true() { 6835 void test_parseNonLabeledStatement_true() {
6838 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "true;", []); 6836 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "true;", []);
6839 JUnitTestCase.assertNotNull(statement.expression); 6837 expect(statement.expression, isNotNull);
6840 } 6838 }
6841 6839
6842 void test_parseNonLabeledStatement_typeCast() { 6840 void test_parseNonLabeledStatement_typeCast() {
6843 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "double.NAN as num;", []); 6841 ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatem ent", "double.NAN as num;", []);
6844 JUnitTestCase.assertNotNull(statement.expression); 6842 expect(statement.expression, isNotNull);
6845 } 6843 }
6846 6844
6847 void test_parseNormalFormalParameter_field_const_noType() { 6845 void test_parseNormalFormalParameter_field_const_noType() {
6848 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "const this.a)", []); 6846 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "const this.a)", []);
6849 JUnitTestCase.assertNotNull(parameter.keyword); 6847 expect(parameter.keyword, isNotNull);
6850 JUnitTestCase.assertNull(parameter.type); 6848 expect(parameter.type, isNull);
6851 JUnitTestCase.assertNotNull(parameter.identifier); 6849 expect(parameter.identifier, isNotNull);
6852 JUnitTestCase.assertNull(parameter.parameters); 6850 expect(parameter.parameters, isNull);
6853 } 6851 }
6854 6852
6855 void test_parseNormalFormalParameter_field_const_type() { 6853 void test_parseNormalFormalParameter_field_const_type() {
6856 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "const A this.a)", []); 6854 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "const A this.a)", []);
6857 JUnitTestCase.assertNotNull(parameter.keyword); 6855 expect(parameter.keyword, isNotNull);
6858 JUnitTestCase.assertNotNull(parameter.type); 6856 expect(parameter.type, isNotNull);
6859 JUnitTestCase.assertNotNull(parameter.identifier); 6857 expect(parameter.identifier, isNotNull);
6860 JUnitTestCase.assertNull(parameter.parameters); 6858 expect(parameter.parameters, isNull);
6861 } 6859 }
6862 6860
6863 void test_parseNormalFormalParameter_field_final_noType() { 6861 void test_parseNormalFormalParameter_field_final_noType() {
6864 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "final this.a)", []); 6862 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "final this.a)", []);
6865 JUnitTestCase.assertNotNull(parameter.keyword); 6863 expect(parameter.keyword, isNotNull);
6866 JUnitTestCase.assertNull(parameter.type); 6864 expect(parameter.type, isNull);
6867 JUnitTestCase.assertNotNull(parameter.identifier); 6865 expect(parameter.identifier, isNotNull);
6868 JUnitTestCase.assertNull(parameter.parameters); 6866 expect(parameter.parameters, isNull);
6869 } 6867 }
6870 6868
6871 void test_parseNormalFormalParameter_field_final_type() { 6869 void test_parseNormalFormalParameter_field_final_type() {
6872 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "final A this.a)", []); 6870 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "final A this.a)", []);
6873 JUnitTestCase.assertNotNull(parameter.keyword); 6871 expect(parameter.keyword, isNotNull);
6874 JUnitTestCase.assertNotNull(parameter.type); 6872 expect(parameter.type, isNotNull);
6875 JUnitTestCase.assertNotNull(parameter.identifier); 6873 expect(parameter.identifier, isNotNull);
6876 JUnitTestCase.assertNull(parameter.parameters); 6874 expect(parameter.parameters, isNull);
6877 } 6875 }
6878 6876
6879 void test_parseNormalFormalParameter_field_function_nested() { 6877 void test_parseNormalFormalParameter_field_function_nested() {
6880 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a(B b))", []); 6878 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a(B b))", []);
6881 JUnitTestCase.assertNull(parameter.keyword); 6879 expect(parameter.keyword, isNull);
6882 JUnitTestCase.assertNull(parameter.type); 6880 expect(parameter.type, isNull);
6883 JUnitTestCase.assertNotNull(parameter.identifier); 6881 expect(parameter.identifier, isNotNull);
6884 FormalParameterList parameterList = parameter.parameters; 6882 FormalParameterList parameterList = parameter.parameters;
6885 JUnitTestCase.assertNotNull(parameterList); 6883 expect(parameterList, isNotNull);
6886 EngineTestCase.assertSizeOfList(1, parameterList.parameters); 6884 EngineTestCase.assertSizeOfList(1, parameterList.parameters);
6887 } 6885 }
6888 6886
6889 void test_parseNormalFormalParameter_field_function_noNested() { 6887 void test_parseNormalFormalParameter_field_function_noNested() {
6890 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a())", []); 6888 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a())", []);
6891 JUnitTestCase.assertNull(parameter.keyword); 6889 expect(parameter.keyword, isNull);
6892 JUnitTestCase.assertNull(parameter.type); 6890 expect(parameter.type, isNull);
6893 JUnitTestCase.assertNotNull(parameter.identifier); 6891 expect(parameter.identifier, isNotNull);
6894 FormalParameterList parameterList = parameter.parameters; 6892 FormalParameterList parameterList = parameter.parameters;
6895 JUnitTestCase.assertNotNull(parameterList); 6893 expect(parameterList, isNotNull);
6896 EngineTestCase.assertSizeOfList(0, parameterList.parameters); 6894 EngineTestCase.assertSizeOfList(0, parameterList.parameters);
6897 } 6895 }
6898 6896
6899 void test_parseNormalFormalParameter_field_noType() { 6897 void test_parseNormalFormalParameter_field_noType() {
6900 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a)", []); 6898 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "this.a)", []);
6901 JUnitTestCase.assertNull(parameter.keyword); 6899 expect(parameter.keyword, isNull);
6902 JUnitTestCase.assertNull(parameter.type); 6900 expect(parameter.type, isNull);
6903 JUnitTestCase.assertNotNull(parameter.identifier); 6901 expect(parameter.identifier, isNotNull);
6904 JUnitTestCase.assertNull(parameter.parameters); 6902 expect(parameter.parameters, isNull);
6905 } 6903 }
6906 6904
6907 void test_parseNormalFormalParameter_field_type() { 6905 void test_parseNormalFormalParameter_field_type() {
6908 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "A this.a)", []); 6906 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "A this.a)", []);
6909 JUnitTestCase.assertNull(parameter.keyword); 6907 expect(parameter.keyword, isNull);
6910 JUnitTestCase.assertNotNull(parameter.type); 6908 expect(parameter.type, isNotNull);
6911 JUnitTestCase.assertNotNull(parameter.identifier); 6909 expect(parameter.identifier, isNotNull);
6912 JUnitTestCase.assertNull(parameter.parameters); 6910 expect(parameter.parameters, isNull);
6913 } 6911 }
6914 6912
6915 void test_parseNormalFormalParameter_field_var() { 6913 void test_parseNormalFormalParameter_field_var() {
6916 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "var this.a)", []); 6914 FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPar ameter", "var this.a)", []);
6917 JUnitTestCase.assertNotNull(parameter.keyword); 6915 expect(parameter.keyword, isNotNull);
6918 JUnitTestCase.assertNull(parameter.type); 6916 expect(parameter.type, isNull);
6919 JUnitTestCase.assertNotNull(parameter.identifier); 6917 expect(parameter.identifier, isNotNull);
6920 JUnitTestCase.assertNull(parameter.parameters); 6918 expect(parameter.parameters, isNull);
6921 } 6919 }
6922 6920
6923 void test_parseNormalFormalParameter_function_noType() { 6921 void test_parseNormalFormalParameter_function_noType() {
6924 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "a())", []); 6922 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "a())", []);
6925 JUnitTestCase.assertNull(parameter.returnType); 6923 expect(parameter.returnType, isNull);
6926 JUnitTestCase.assertNotNull(parameter.identifier); 6924 expect(parameter.identifier, isNotNull);
6927 JUnitTestCase.assertNotNull(parameter.parameters); 6925 expect(parameter.parameters, isNotNull);
6928 } 6926 }
6929 6927
6930 void test_parseNormalFormalParameter_function_type() { 6928 void test_parseNormalFormalParameter_function_type() {
6931 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "A a())", []); 6929 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "A a())", []);
6932 JUnitTestCase.assertNotNull(parameter.returnType); 6930 expect(parameter.returnType, isNotNull);
6933 JUnitTestCase.assertNotNull(parameter.identifier); 6931 expect(parameter.identifier, isNotNull);
6934 JUnitTestCase.assertNotNull(parameter.parameters); 6932 expect(parameter.parameters, isNotNull);
6935 } 6933 }
6936 6934
6937 void test_parseNormalFormalParameter_function_void() { 6935 void test_parseNormalFormalParameter_function_void() {
6938 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "void a())", []); 6936 FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalF ormalParameter", "void a())", []);
6939 JUnitTestCase.assertNotNull(parameter.returnType); 6937 expect(parameter.returnType, isNotNull);
6940 JUnitTestCase.assertNotNull(parameter.identifier); 6938 expect(parameter.identifier, isNotNull);
6941 JUnitTestCase.assertNotNull(parameter.parameters); 6939 expect(parameter.parameters, isNotNull);
6942 } 6940 }
6943 6941
6944 void test_parseNormalFormalParameter_simple_const_noType() { 6942 void test_parseNormalFormalParameter_simple_const_noType() {
6945 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "const a)", []); 6943 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "const a)", []);
6946 JUnitTestCase.assertNotNull(parameter.keyword); 6944 expect(parameter.keyword, isNotNull);
6947 JUnitTestCase.assertNull(parameter.type); 6945 expect(parameter.type, isNull);
6948 JUnitTestCase.assertNotNull(parameter.identifier); 6946 expect(parameter.identifier, isNotNull);
6949 } 6947 }
6950 6948
6951 void test_parseNormalFormalParameter_simple_const_type() { 6949 void test_parseNormalFormalParameter_simple_const_type() {
6952 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "const A a)", []); 6950 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "const A a)", []);
6953 JUnitTestCase.assertNotNull(parameter.keyword); 6951 expect(parameter.keyword, isNotNull);
6954 JUnitTestCase.assertNotNull(parameter.type); 6952 expect(parameter.type, isNotNull);
6955 JUnitTestCase.assertNotNull(parameter.identifier); 6953 expect(parameter.identifier, isNotNull);
6956 } 6954 }
6957 6955
6958 void test_parseNormalFormalParameter_simple_final_noType() { 6956 void test_parseNormalFormalParameter_simple_final_noType() {
6959 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "final a)", []); 6957 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "final a)", []);
6960 JUnitTestCase.assertNotNull(parameter.keyword); 6958 expect(parameter.keyword, isNotNull);
6961 JUnitTestCase.assertNull(parameter.type); 6959 expect(parameter.type, isNull);
6962 JUnitTestCase.assertNotNull(parameter.identifier); 6960 expect(parameter.identifier, isNotNull);
6963 } 6961 }
6964 6962
6965 void test_parseNormalFormalParameter_simple_final_type() { 6963 void test_parseNormalFormalParameter_simple_final_type() {
6966 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "final A a)", []); 6964 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "final A a)", []);
6967 JUnitTestCase.assertNotNull(parameter.keyword); 6965 expect(parameter.keyword, isNotNull);
6968 JUnitTestCase.assertNotNull(parameter.type); 6966 expect(parameter.type, isNotNull);
6969 JUnitTestCase.assertNotNull(parameter.identifier); 6967 expect(parameter.identifier, isNotNull);
6970 } 6968 }
6971 6969
6972 void test_parseNormalFormalParameter_simple_noType() { 6970 void test_parseNormalFormalParameter_simple_noType() {
6973 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "a)", []); 6971 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "a)", []);
6974 JUnitTestCase.assertNull(parameter.keyword); 6972 expect(parameter.keyword, isNull);
6975 JUnitTestCase.assertNull(parameter.type); 6973 expect(parameter.type, isNull);
6976 JUnitTestCase.assertNotNull(parameter.identifier); 6974 expect(parameter.identifier, isNotNull);
6977 } 6975 }
6978 6976
6979 void test_parseNormalFormalParameter_simple_type() { 6977 void test_parseNormalFormalParameter_simple_type() {
6980 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "A a)", []); 6978 SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalPa rameter", "A a)", []);
6981 JUnitTestCase.assertNull(parameter.keyword); 6979 expect(parameter.keyword, isNull);
6982 JUnitTestCase.assertNotNull(parameter.type); 6980 expect(parameter.type, isNotNull);
6983 JUnitTestCase.assertNotNull(parameter.identifier); 6981 expect(parameter.identifier, isNotNull);
6984 } 6982 }
6985 6983
6986 void test_parseOperator() { 6984 void test_parseOperator() {
6987 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 6985 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
6988 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 6986 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
6989 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c ommentAndMetadata(comment, []), null, returnType], "operator +(A a);"); 6987 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c ommentAndMetadata(comment, []), null, returnType], "operator +(A a);");
6990 JUnitTestCase.assertNotNull(method.body); 6988 expect(method.body, isNotNull);
6991 JUnitTestCase.assertEquals(comment, method.documentationComment); 6989 expect(method.documentationComment, comment);
6992 JUnitTestCase.assertNull(method.externalKeyword); 6990 expect(method.externalKeyword, isNull);
6993 JUnitTestCase.assertNull(method.modifierKeyword); 6991 expect(method.modifierKeyword, isNull);
6994 JUnitTestCase.assertNotNull(method.name); 6992 expect(method.name, isNotNull);
6995 JUnitTestCase.assertNotNull(method.operatorKeyword); 6993 expect(method.operatorKeyword, isNotNull);
6996 JUnitTestCase.assertNotNull(method.parameters); 6994 expect(method.parameters, isNotNull);
6997 JUnitTestCase.assertNull(method.propertyKeyword); 6995 expect(method.propertyKeyword, isNull);
6998 JUnitTestCase.assertEquals(returnType, method.returnType); 6996 expect(method.returnType, returnType);
6999 } 6997 }
7000 6998
7001 void test_parseOptionalReturnType() { 6999 void test_parseOptionalReturnType() {
7002 // TODO(brianwilkerson) Implement tests for this method. 7000 // TODO(brianwilkerson) Implement tests for this method.
7003 } 7001 }
7004 7002
7005 void test_parsePartDirective_part() { 7003 void test_parsePartDirective_part() {
7006 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object > [emptyCommentAndMetadata()], "part 'lib/lib.dart';"); 7004 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object > [emptyCommentAndMetadata()], "part 'lib/lib.dart';");
7007 JUnitTestCase.assertNotNull(directive.partToken); 7005 expect(directive.partToken, isNotNull);
7008 JUnitTestCase.assertNotNull(directive.uri); 7006 expect(directive.uri, isNotNull);
7009 JUnitTestCase.assertNotNull(directive.semicolon); 7007 expect(directive.semicolon, isNotNull);
7010 } 7008 }
7011 7009
7012 void test_parsePartDirective_partOf() { 7010 void test_parsePartDirective_partOf() {
7013 PartOfDirective directive = ParserTestCase.parse("parsePartDirective", <Obje ct> [emptyCommentAndMetadata()], "part of l;"); 7011 PartOfDirective directive = ParserTestCase.parse("parsePartDirective", <Obje ct> [emptyCommentAndMetadata()], "part of l;");
7014 JUnitTestCase.assertNotNull(directive.partToken); 7012 expect(directive.partToken, isNotNull);
7015 JUnitTestCase.assertNotNull(directive.ofToken); 7013 expect(directive.ofToken, isNotNull);
7016 JUnitTestCase.assertNotNull(directive.libraryName); 7014 expect(directive.libraryName, isNotNull);
7017 JUnitTestCase.assertNotNull(directive.semicolon); 7015 expect(directive.semicolon, isNotNull);
7018 } 7016 }
7019 7017
7020 void test_parsePostfixExpression_decrement() { 7018 void test_parsePostfixExpression_decrement() {
7021 PostfixExpression expression = ParserTestCase.parse4("parsePostfixExpression ", "i--", []); 7019 PostfixExpression expression = ParserTestCase.parse4("parsePostfixExpression ", "i--", []);
7022 JUnitTestCase.assertNotNull(expression.operand); 7020 expect(expression.operand, isNotNull);
7023 JUnitTestCase.assertNotNull(expression.operator); 7021 expect(expression.operator, isNotNull);
7024 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 7022 expect(expression.operator.type, TokenType.MINUS_MINUS);
7025 } 7023 }
7026 7024
7027 void test_parsePostfixExpression_increment() { 7025 void test_parsePostfixExpression_increment() {
7028 PostfixExpression expression = ParserTestCase.parse4("parsePostfixExpression ", "i++", []); 7026 PostfixExpression expression = ParserTestCase.parse4("parsePostfixExpression ", "i++", []);
7029 JUnitTestCase.assertNotNull(expression.operand); 7027 expect(expression.operand, isNotNull);
7030 JUnitTestCase.assertNotNull(expression.operator); 7028 expect(expression.operator, isNotNull);
7031 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 7029 expect(expression.operator.type, TokenType.PLUS_PLUS);
7032 } 7030 }
7033 7031
7034 void test_parsePostfixExpression_none_indexExpression() { 7032 void test_parsePostfixExpression_none_indexExpression() {
7035 IndexExpression expression = ParserTestCase.parse4("parsePostfixExpression", "a[0]", []); 7033 IndexExpression expression = ParserTestCase.parse4("parsePostfixExpression", "a[0]", []);
7036 JUnitTestCase.assertNotNull(expression.target); 7034 expect(expression.target, isNotNull);
7037 JUnitTestCase.assertNotNull(expression.index); 7035 expect(expression.index, isNotNull);
7038 } 7036 }
7039 7037
7040 void test_parsePostfixExpression_none_methodInvocation() { 7038 void test_parsePostfixExpression_none_methodInvocation() {
7041 MethodInvocation expression = ParserTestCase.parse4("parsePostfixExpression" , "a.m()", []); 7039 MethodInvocation expression = ParserTestCase.parse4("parsePostfixExpression" , "a.m()", []);
7042 JUnitTestCase.assertNotNull(expression.target); 7040 expect(expression.target, isNotNull);
7043 JUnitTestCase.assertNotNull(expression.methodName); 7041 expect(expression.methodName, isNotNull);
7044 JUnitTestCase.assertNotNull(expression.argumentList); 7042 expect(expression.argumentList, isNotNull);
7045 } 7043 }
7046 7044
7047 void test_parsePostfixExpression_none_propertyAccess() { 7045 void test_parsePostfixExpression_none_propertyAccess() {
7048 PrefixedIdentifier expression = ParserTestCase.parse4("parsePostfixExpressio n", "a.b", []); 7046 PrefixedIdentifier expression = ParserTestCase.parse4("parsePostfixExpressio n", "a.b", []);
7049 JUnitTestCase.assertNotNull(expression.prefix); 7047 expect(expression.prefix, isNotNull);
7050 JUnitTestCase.assertNotNull(expression.identifier); 7048 expect(expression.identifier, isNotNull);
7051 } 7049 }
7052 7050
7053 void test_parsePrefixedIdentifier_noPrefix() { 7051 void test_parsePrefixedIdentifier_noPrefix() {
7054 String lexeme = "bar"; 7052 String lexeme = "bar";
7055 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrefixedIdentifier ", lexeme, []); 7053 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrefixedIdentifier ", lexeme, []);
7056 JUnitTestCase.assertNotNull(identifier.token); 7054 expect(identifier.token, isNotNull);
7057 JUnitTestCase.assertEquals(lexeme, identifier.name); 7055 expect(identifier.name, lexeme);
7058 } 7056 }
7059 7057
7060 void test_parsePrefixedIdentifier_prefix() { 7058 void test_parsePrefixedIdentifier_prefix() {
7061 String lexeme = "foo.bar"; 7059 String lexeme = "foo.bar";
7062 PrefixedIdentifier identifier = ParserTestCase.parse4("parsePrefixedIdentifi er", lexeme, []); 7060 PrefixedIdentifier identifier = ParserTestCase.parse4("parsePrefixedIdentifi er", lexeme, []);
7063 JUnitTestCase.assertEquals("foo", identifier.prefix.name); 7061 expect(identifier.prefix.name, "foo");
7064 JUnitTestCase.assertNotNull(identifier.period); 7062 expect(identifier.period, isNotNull);
7065 JUnitTestCase.assertEquals("bar", identifier.identifier.name); 7063 expect(identifier.identifier.name, "bar");
7066 } 7064 }
7067 7065
7068 void test_parsePrimaryExpression_const() { 7066 void test_parsePrimaryExpression_const() {
7069 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "const A()", []); 7067 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "const A()", []);
7070 JUnitTestCase.assertNotNull(expression); 7068 expect(expression, isNotNull);
7071 } 7069 }
7072 7070
7073 void test_parsePrimaryExpression_double() { 7071 void test_parsePrimaryExpression_double() {
7074 String doubleLiteral = "3.2e4"; 7072 String doubleLiteral = "3.2e4";
7075 DoubleLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", doub leLiteral, []); 7073 DoubleLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", doub leLiteral, []);
7076 JUnitTestCase.assertNotNull(literal.literal); 7074 expect(literal.literal, isNotNull);
7077 JUnitTestCase.assertEquals(double.parse(doubleLiteral), literal.value); 7075 expect(literal.value, double.parse(doubleLiteral));
7078 } 7076 }
7079 7077
7080 void test_parsePrimaryExpression_false() { 7078 void test_parsePrimaryExpression_false() {
7081 BooleanLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "fa lse", []); 7079 BooleanLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "fa lse", []);
7082 JUnitTestCase.assertNotNull(literal.literal); 7080 expect(literal.literal, isNotNull);
7083 JUnitTestCase.assertFalse(literal.value); 7081 expect(literal.value, isFalse);
7084 } 7082 }
7085 7083
7086 void test_parsePrimaryExpression_function_arguments() { 7084 void test_parsePrimaryExpression_function_arguments() {
7087 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "(int i) => i + 1", []); 7085 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "(int i) => i + 1", []);
7088 JUnitTestCase.assertNotNull(expression.parameters); 7086 expect(expression.parameters, isNotNull);
7089 JUnitTestCase.assertNotNull(expression.body); 7087 expect(expression.body, isNotNull);
7090 } 7088 }
7091 7089
7092 void test_parsePrimaryExpression_function_noArguments() { 7090 void test_parsePrimaryExpression_function_noArguments() {
7093 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "() => 42", []); 7091 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "() => 42", []);
7094 JUnitTestCase.assertNotNull(expression.parameters); 7092 expect(expression.parameters, isNotNull);
7095 JUnitTestCase.assertNotNull(expression.body); 7093 expect(expression.body, isNotNull);
7096 } 7094 }
7097 7095
7098 void test_parsePrimaryExpression_hex() { 7096 void test_parsePrimaryExpression_hex() {
7099 String hexLiteral = "3F"; 7097 String hexLiteral = "3F";
7100 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "0x $hexLiteral", []); 7098 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "0x $hexLiteral", []);
7101 JUnitTestCase.assertNotNull(literal.literal); 7099 expect(literal.literal, isNotNull);
7102 JUnitTestCase.assertEquals(int.parse(hexLiteral, radix: 16), literal.value); 7100 expect(literal.value, int.parse(hexLiteral, radix: 16));
7103 } 7101 }
7104 7102
7105 void test_parsePrimaryExpression_identifier() { 7103 void test_parsePrimaryExpression_identifier() {
7106 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrimaryExpression" , "a", []); 7104 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrimaryExpression" , "a", []);
7107 JUnitTestCase.assertNotNull(identifier); 7105 expect(identifier, isNotNull);
7108 } 7106 }
7109 7107
7110 void test_parsePrimaryExpression_int() { 7108 void test_parsePrimaryExpression_int() {
7111 String intLiteral = "472"; 7109 String intLiteral = "472";
7112 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", int Literal, []); 7110 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", int Literal, []);
7113 JUnitTestCase.assertNotNull(literal.literal); 7111 expect(literal.literal, isNotNull);
7114 JUnitTestCase.assertEquals(int.parse(intLiteral), literal.value); 7112 expect(literal.value, int.parse(intLiteral));
7115 } 7113 }
7116 7114
7117 void test_parsePrimaryExpression_listLiteral() { 7115 void test_parsePrimaryExpression_listLiteral() {
7118 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[ ]", []); 7116 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[ ]", []);
7119 JUnitTestCase.assertNotNull(literal); 7117 expect(literal, isNotNull);
7120 } 7118 }
7121 7119
7122 void test_parsePrimaryExpression_listLiteral_index() { 7120 void test_parsePrimaryExpression_listLiteral_index() {
7123 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[]", []); 7121 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[]", []);
7124 JUnitTestCase.assertNotNull(literal); 7122 expect(literal, isNotNull);
7125 } 7123 }
7126 7124
7127 void test_parsePrimaryExpression_listLiteral_typed() { 7125 void test_parsePrimaryExpression_listLiteral_typed() {
7128 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]", []); 7126 ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]", []);
7129 JUnitTestCase.assertNotNull(literal.typeArguments); 7127 expect(literal.typeArguments, isNotNull);
7130 EngineTestCase.assertSizeOfList(1, literal.typeArguments.arguments); 7128 EngineTestCase.assertSizeOfList(1, literal.typeArguments.arguments);
7131 } 7129 }
7132 7130
7133 void test_parsePrimaryExpression_mapLiteral() { 7131 void test_parsePrimaryExpression_mapLiteral() {
7134 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "{}", [ ]); 7132 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "{}", [ ]);
7135 JUnitTestCase.assertNotNull(literal); 7133 expect(literal, isNotNull);
7136 } 7134 }
7137 7135
7138 void test_parsePrimaryExpression_mapLiteral_typed() { 7136 void test_parsePrimaryExpression_mapLiteral_typed() {
7139 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A, B> {}", []); 7137 MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A, B> {}", []);
7140 JUnitTestCase.assertNotNull(literal.typeArguments); 7138 expect(literal.typeArguments, isNotNull);
7141 EngineTestCase.assertSizeOfList(2, literal.typeArguments.arguments); 7139 EngineTestCase.assertSizeOfList(2, literal.typeArguments.arguments);
7142 } 7140 }
7143 7141
7144 void test_parsePrimaryExpression_new() { 7142 void test_parsePrimaryExpression_new() {
7145 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "new A()", []); 7143 InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryE xpression", "new A()", []);
7146 JUnitTestCase.assertNotNull(expression); 7144 expect(expression, isNotNull);
7147 } 7145 }
7148 7146
7149 void test_parsePrimaryExpression_null() { 7147 void test_parsePrimaryExpression_null() {
7150 NullLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "null" , []); 7148 NullLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "null" , []);
7151 JUnitTestCase.assertNotNull(literal.literal); 7149 expect(literal.literal, isNotNull);
7152 } 7150 }
7153 7151
7154 void test_parsePrimaryExpression_parenthesized() { 7152 void test_parsePrimaryExpression_parenthesized() {
7155 ParenthesizedExpression expression = ParserTestCase.parse4("parsePrimaryExpr ession", "(x)", []); 7153 ParenthesizedExpression expression = ParserTestCase.parse4("parsePrimaryExpr ession", "(x)", []);
7156 JUnitTestCase.assertNotNull(expression); 7154 expect(expression, isNotNull);
7157 } 7155 }
7158 7156
7159 void test_parsePrimaryExpression_string() { 7157 void test_parsePrimaryExpression_string() {
7160 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "\"string\"", []); 7158 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "\"string\"", []);
7161 JUnitTestCase.assertFalse(literal.isMultiline); 7159 expect(literal.isMultiline, isFalse);
7162 JUnitTestCase.assertFalse(literal.isRaw); 7160 expect(literal.isRaw, isFalse);
7163 JUnitTestCase.assertEquals("string", literal.value); 7161 expect(literal.value, "string");
7164 } 7162 }
7165 7163
7166 void test_parsePrimaryExpression_string_multiline() { 7164 void test_parsePrimaryExpression_string_multiline() {
7167 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "'''string'''", []); 7165 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "'''string'''", []);
7168 JUnitTestCase.assertTrue(literal.isMultiline); 7166 expect(literal.isMultiline, isTrue);
7169 JUnitTestCase.assertFalse(literal.isRaw); 7167 expect(literal.isRaw, isFalse);
7170 JUnitTestCase.assertEquals("string", literal.value); 7168 expect(literal.value, "string");
7171 } 7169 }
7172 7170
7173 void test_parsePrimaryExpression_string_raw() { 7171 void test_parsePrimaryExpression_string_raw() {
7174 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "r'string'", []); 7172 SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression" , "r'string'", []);
7175 JUnitTestCase.assertFalse(literal.isMultiline); 7173 expect(literal.isMultiline, isFalse);
7176 JUnitTestCase.assertTrue(literal.isRaw); 7174 expect(literal.isRaw, isTrue);
7177 JUnitTestCase.assertEquals("string", literal.value); 7175 expect(literal.value, "string");
7178 } 7176 }
7179 7177
7180 void test_parsePrimaryExpression_super() { 7178 void test_parsePrimaryExpression_super() {
7181 PropertyAccess propertyAccess = ParserTestCase.parse4("parsePrimaryExpressio n", "super.x", []); 7179 PropertyAccess propertyAccess = ParserTestCase.parse4("parsePrimaryExpressio n", "super.x", []);
7182 JUnitTestCase.assertTrue(propertyAccess.target is SuperExpression); 7180 expect(propertyAccess.target is SuperExpression, isTrue);
7183 JUnitTestCase.assertNotNull(propertyAccess.operator); 7181 expect(propertyAccess.operator, isNotNull);
7184 JUnitTestCase.assertEquals(TokenType.PERIOD, propertyAccess.operator.type); 7182 expect(propertyAccess.operator.type, TokenType.PERIOD);
7185 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 7183 expect(propertyAccess.propertyName, isNotNull);
7186 } 7184 }
7187 7185
7188 void test_parsePrimaryExpression_this() { 7186 void test_parsePrimaryExpression_this() {
7189 ThisExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "this", []); 7187 ThisExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "this", []);
7190 JUnitTestCase.assertNotNull(expression.keyword); 7188 expect(expression.keyword, isNotNull);
7191 } 7189 }
7192 7190
7193 void test_parsePrimaryExpression_true() { 7191 void test_parsePrimaryExpression_true() {
7194 BooleanLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "tr ue", []); 7192 BooleanLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "tr ue", []);
7195 JUnitTestCase.assertNotNull(literal.literal); 7193 expect(literal.literal, isNotNull);
7196 JUnitTestCase.assertTrue(literal.value); 7194 expect(literal.value, isTrue);
7197 } 7195 }
7198 7196
7199 void test_Parser() { 7197 void test_Parser() {
7200 JUnitTestCase.assertNotNull(new Parser(null, null)); 7198 expect(new Parser(null, null), isNotNull);
7201 } 7199 }
7202 7200
7203 void test_parseRedirectingConstructorInvocation_named() { 7201 void test_parseRedirectingConstructorInvocation_named() {
7204 RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRe directingConstructorInvocation", "this.a()", []); 7202 RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRe directingConstructorInvocation", "this.a()", []);
7205 JUnitTestCase.assertNotNull(invocation.argumentList); 7203 expect(invocation.argumentList, isNotNull);
7206 JUnitTestCase.assertNotNull(invocation.constructorName); 7204 expect(invocation.constructorName, isNotNull);
7207 JUnitTestCase.assertNotNull(invocation.keyword); 7205 expect(invocation.keyword, isNotNull);
7208 JUnitTestCase.assertNotNull(invocation.period); 7206 expect(invocation.period, isNotNull);
7209 } 7207 }
7210 7208
7211 void test_parseRedirectingConstructorInvocation_unnamed() { 7209 void test_parseRedirectingConstructorInvocation_unnamed() {
7212 RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRe directingConstructorInvocation", "this()", []); 7210 RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRe directingConstructorInvocation", "this()", []);
7213 JUnitTestCase.assertNotNull(invocation.argumentList); 7211 expect(invocation.argumentList, isNotNull);
7214 JUnitTestCase.assertNull(invocation.constructorName); 7212 expect(invocation.constructorName, isNull);
7215 JUnitTestCase.assertNotNull(invocation.keyword); 7213 expect(invocation.keyword, isNotNull);
7216 JUnitTestCase.assertNull(invocation.period); 7214 expect(invocation.period, isNull);
7217 } 7215 }
7218 7216
7219 void test_parseRelationalExpression_as() { 7217 void test_parseRelationalExpression_as() {
7220 AsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x as Y", []); 7218 AsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x as Y", []);
7221 JUnitTestCase.assertNotNull(expression.expression); 7219 expect(expression.expression, isNotNull);
7222 JUnitTestCase.assertNotNull(expression.asOperator); 7220 expect(expression.asOperator, isNotNull);
7223 JUnitTestCase.assertNotNull(expression.type); 7221 expect(expression.type, isNotNull);
7224 } 7222 }
7225 7223
7226 void test_parseRelationalExpression_is() { 7224 void test_parseRelationalExpression_is() {
7227 IsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x is y", []); 7225 IsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x is y", []);
7228 JUnitTestCase.assertNotNull(expression.expression); 7226 expect(expression.expression, isNotNull);
7229 JUnitTestCase.assertNotNull(expression.isOperator); 7227 expect(expression.isOperator, isNotNull);
7230 JUnitTestCase.assertNull(expression.notOperator); 7228 expect(expression.notOperator, isNull);
7231 JUnitTestCase.assertNotNull(expression.type); 7229 expect(expression.type, isNotNull);
7232 } 7230 }
7233 7231
7234 void test_parseRelationalExpression_isNot() { 7232 void test_parseRelationalExpression_isNot() {
7235 IsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x is! y", []); 7233 IsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x is! y", []);
7236 JUnitTestCase.assertNotNull(expression.expression); 7234 expect(expression.expression, isNotNull);
7237 JUnitTestCase.assertNotNull(expression.isOperator); 7235 expect(expression.isOperator, isNotNull);
7238 JUnitTestCase.assertNotNull(expression.notOperator); 7236 expect(expression.notOperator, isNotNull);
7239 JUnitTestCase.assertNotNull(expression.type); 7237 expect(expression.type, isNotNull);
7240 } 7238 }
7241 7239
7242 void test_parseRelationalExpression_normal() { 7240 void test_parseRelationalExpression_normal() {
7243 BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpressi on", "x < y", []); 7241 BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpressi on", "x < y", []);
7244 JUnitTestCase.assertNotNull(expression.leftOperand); 7242 expect(expression.leftOperand, isNotNull);
7245 JUnitTestCase.assertNotNull(expression.operator); 7243 expect(expression.operator, isNotNull);
7246 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type); 7244 expect(expression.operator.type, TokenType.LT);
7247 JUnitTestCase.assertNotNull(expression.rightOperand); 7245 expect(expression.rightOperand, isNotNull);
7248 } 7246 }
7249 7247
7250 void test_parseRelationalExpression_super() { 7248 void test_parseRelationalExpression_super() {
7251 BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpressi on", "super < y", []); 7249 BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpressi on", "super < y", []);
7252 JUnitTestCase.assertNotNull(expression.leftOperand); 7250 expect(expression.leftOperand, isNotNull);
7253 JUnitTestCase.assertNotNull(expression.operator); 7251 expect(expression.operator, isNotNull);
7254 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type); 7252 expect(expression.operator.type, TokenType.LT);
7255 JUnitTestCase.assertNotNull(expression.rightOperand); 7253 expect(expression.rightOperand, isNotNull);
7256 } 7254 }
7257 7255
7258 void test_parseRethrowExpression() { 7256 void test_parseRethrowExpression() {
7259 RethrowExpression expression = ParserTestCase.parse4("parseRethrowExpression ", "rethrow;", []); 7257 RethrowExpression expression = ParserTestCase.parse4("parseRethrowExpression ", "rethrow;", []);
7260 JUnitTestCase.assertNotNull(expression.keyword); 7258 expect(expression.keyword, isNotNull);
7261 } 7259 }
7262 7260
7263 void test_parseReturnStatement_noValue() { 7261 void test_parseReturnStatement_noValue() {
7264 ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "r eturn;", []); 7262 ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "r eturn;", []);
7265 JUnitTestCase.assertNotNull(statement.keyword); 7263 expect(statement.keyword, isNotNull);
7266 JUnitTestCase.assertNull(statement.expression); 7264 expect(statement.expression, isNull);
7267 JUnitTestCase.assertNotNull(statement.semicolon); 7265 expect(statement.semicolon, isNotNull);
7268 } 7266 }
7269 7267
7270 void test_parseReturnStatement_value() { 7268 void test_parseReturnStatement_value() {
7271 ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "r eturn x;", []); 7269 ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "r eturn x;", []);
7272 JUnitTestCase.assertNotNull(statement.keyword); 7270 expect(statement.keyword, isNotNull);
7273 JUnitTestCase.assertNotNull(statement.expression); 7271 expect(statement.expression, isNotNull);
7274 JUnitTestCase.assertNotNull(statement.semicolon); 7272 expect(statement.semicolon, isNotNull);
7275 } 7273 }
7276 7274
7277 void test_parseReturnType_nonVoid() { 7275 void test_parseReturnType_nonVoid() {
7278 TypeName typeName = ParserTestCase.parse4("parseReturnType", "A<B>", []); 7276 TypeName typeName = ParserTestCase.parse4("parseReturnType", "A<B>", []);
7279 JUnitTestCase.assertNotNull(typeName.name); 7277 expect(typeName.name, isNotNull);
7280 JUnitTestCase.assertNotNull(typeName.typeArguments); 7278 expect(typeName.typeArguments, isNotNull);
7281 } 7279 }
7282 7280
7283 void test_parseReturnType_void() { 7281 void test_parseReturnType_void() {
7284 TypeName typeName = ParserTestCase.parse4("parseReturnType", "void", []); 7282 TypeName typeName = ParserTestCase.parse4("parseReturnType", "void", []);
7285 JUnitTestCase.assertNotNull(typeName.name); 7283 expect(typeName.name, isNotNull);
7286 JUnitTestCase.assertNull(typeName.typeArguments); 7284 expect(typeName.typeArguments, isNull);
7287 } 7285 }
7288 7286
7289 void test_parseSetter_nonStatic() { 7287 void test_parseSetter_nonStatic() {
7290 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 7288 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
7291 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 7289 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
7292 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "set a(var x);"); 7290 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "set a(var x);");
7293 JUnitTestCase.assertNotNull(method.body); 7291 expect(method.body, isNotNull);
7294 JUnitTestCase.assertEquals(comment, method.documentationComment); 7292 expect(method.documentationComment, comment);
7295 JUnitTestCase.assertNull(method.externalKeyword); 7293 expect(method.externalKeyword, isNull);
7296 JUnitTestCase.assertNull(method.modifierKeyword); 7294 expect(method.modifierKeyword, isNull);
7297 JUnitTestCase.assertNotNull(method.name); 7295 expect(method.name, isNotNull);
7298 JUnitTestCase.assertNull(method.operatorKeyword); 7296 expect(method.operatorKeyword, isNull);
7299 JUnitTestCase.assertNotNull(method.parameters); 7297 expect(method.parameters, isNotNull);
7300 JUnitTestCase.assertNotNull(method.propertyKeyword); 7298 expect(method.propertyKeyword, isNotNull);
7301 JUnitTestCase.assertEquals(returnType, method.returnType); 7299 expect(method.returnType, returnType);
7302 } 7300 }
7303 7301
7304 void test_parseSetter_static() { 7302 void test_parseSetter_static() {
7305 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 7303 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
7306 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC); 7304 Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
7307 TypeName returnType = new TypeName(new SimpleIdentifier(null), null); 7305 TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
7308 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [ 7306 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [
7309 commentAndMetadata(comment, []), 7307 commentAndMetadata(comment, []),
7310 null, 7308 null,
7311 staticKeyword, 7309 staticKeyword,
7312 returnType], "set a(var x) {}"); 7310 returnType], "set a(var x) {}");
7313 JUnitTestCase.assertNotNull(method.body); 7311 expect(method.body, isNotNull);
7314 JUnitTestCase.assertEquals(comment, method.documentationComment); 7312 expect(method.documentationComment, comment);
7315 JUnitTestCase.assertNull(method.externalKeyword); 7313 expect(method.externalKeyword, isNull);
7316 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 7314 expect(method.modifierKeyword, staticKeyword);
7317 JUnitTestCase.assertNotNull(method.name); 7315 expect(method.name, isNotNull);
7318 JUnitTestCase.assertNull(method.operatorKeyword); 7316 expect(method.operatorKeyword, isNull);
7319 JUnitTestCase.assertNotNull(method.parameters); 7317 expect(method.parameters, isNotNull);
7320 JUnitTestCase.assertNotNull(method.propertyKeyword); 7318 expect(method.propertyKeyword, isNotNull);
7321 JUnitTestCase.assertEquals(returnType, method.returnType); 7319 expect(method.returnType, returnType);
7322 } 7320 }
7323 7321
7324 void test_parseShiftExpression_normal() { 7322 void test_parseShiftExpression_normal() {
7325 BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "x << y", []); 7323 BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "x << y", []);
7326 JUnitTestCase.assertNotNull(expression.leftOperand); 7324 expect(expression.leftOperand, isNotNull);
7327 JUnitTestCase.assertNotNull(expression.operator); 7325 expect(expression.operator, isNotNull);
7328 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type); 7326 expect(expression.operator.type, TokenType.LT_LT);
7329 JUnitTestCase.assertNotNull(expression.rightOperand); 7327 expect(expression.rightOperand, isNotNull);
7330 } 7328 }
7331 7329
7332 void test_parseShiftExpression_super() { 7330 void test_parseShiftExpression_super() {
7333 BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "super << y", []); 7331 BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "super << y", []);
7334 JUnitTestCase.assertNotNull(expression.leftOperand); 7332 expect(expression.leftOperand, isNotNull);
7335 JUnitTestCase.assertNotNull(expression.operator); 7333 expect(expression.operator, isNotNull);
7336 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type); 7334 expect(expression.operator.type, TokenType.LT_LT);
7337 JUnitTestCase.assertNotNull(expression.rightOperand); 7335 expect(expression.rightOperand, isNotNull);
7338 } 7336 }
7339 7337
7340 void test_parseSimpleIdentifier_builtInIdentifier() { 7338 void test_parseSimpleIdentifier_builtInIdentifier() {
7341 String lexeme = "as"; 7339 String lexeme = "as";
7342 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier", lexeme, []); 7340 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier", lexeme, []);
7343 JUnitTestCase.assertNotNull(identifier.token); 7341 expect(identifier.token, isNotNull);
7344 JUnitTestCase.assertEquals(lexeme, identifier.name); 7342 expect(identifier.name, lexeme);
7345 } 7343 }
7346 7344
7347 void test_parseSimpleIdentifier_normalIdentifier() { 7345 void test_parseSimpleIdentifier_normalIdentifier() {
7348 String lexeme = "foo"; 7346 String lexeme = "foo";
7349 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier", lexeme, []); 7347 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier", lexeme, []);
7350 JUnitTestCase.assertNotNull(identifier.token); 7348 expect(identifier.token, isNotNull);
7351 JUnitTestCase.assertEquals(lexeme, identifier.name); 7349 expect(identifier.name, lexeme);
7352 } 7350 }
7353 7351
7354 void test_parseSimpleIdentifier1_normalIdentifier() { 7352 void test_parseSimpleIdentifier1_normalIdentifier() {
7355 // TODO(brianwilkerson) Implement tests for this method. 7353 // TODO(brianwilkerson) Implement tests for this method.
7356 } 7354 }
7357 7355
7358 void test_parseStatement_functionDeclaration() { 7356 void test_parseStatement_functionDeclaration() {
7359 // TODO(brianwilkerson) Implement more tests for this method. 7357 // TODO(brianwilkerson) Implement more tests for this method.
7360 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme nt", "int f(a, b) {};", []); 7358 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme nt", "int f(a, b) {};", []);
7361 JUnitTestCase.assertNotNull(statement.functionDeclaration); 7359 expect(statement.functionDeclaration, isNotNull);
7362 } 7360 }
7363 7361
7364 void test_parseStatement_mulipleLabels() { 7362 void test_parseStatement_mulipleLabels() {
7365 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m: return x;", []); 7363 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m: return x;", []);
7366 EngineTestCase.assertSizeOfList(2, statement.labels); 7364 EngineTestCase.assertSizeOfList(2, statement.labels);
7367 JUnitTestCase.assertNotNull(statement.statement); 7365 expect(statement.statement, isNotNull);
7368 } 7366 }
7369 7367
7370 void test_parseStatement_noLabels() { 7368 void test_parseStatement_noLabels() {
7371 ParserTestCase.parse4("parseStatement", "return x;", []); 7369 ParserTestCase.parse4("parseStatement", "return x;", []);
7372 } 7370 }
7373 7371
7374 void test_parseStatement_singleLabel() { 7372 void test_parseStatement_singleLabel() {
7375 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: ret urn x;", []); 7373 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: ret urn x;", []);
7376 EngineTestCase.assertSizeOfList(1, statement.labels); 7374 EngineTestCase.assertSizeOfList(1, statement.labels);
7377 JUnitTestCase.assertNotNull(statement.statement); 7375 expect(statement.statement, isNotNull);
7378 } 7376 }
7379 7377
7380 void test_parseStatements_multiple() { 7378 void test_parseStatements_multiple() {
7381 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []); 7379 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []);
7382 EngineTestCase.assertSizeOfList(2, statements); 7380 EngineTestCase.assertSizeOfList(2, statements);
7383 } 7381 }
7384 7382
7385 void test_parseStatements_single() { 7383 void test_parseStatements_single() {
7386 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] ); 7384 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] );
7387 EngineTestCase.assertSizeOfList(1, statements); 7385 EngineTestCase.assertSizeOfList(1, statements);
7388 } 7386 }
7389 7387
7390 void test_parseStringLiteral_adjacent() { 7388 void test_parseStringLiteral_adjacent() {
7391 AdjacentStrings literal = ParserTestCase.parse4("parseStringLiteral", "'a' ' b'", []); 7389 AdjacentStrings literal = ParserTestCase.parse4("parseStringLiteral", "'a' ' b'", []);
7392 NodeList<StringLiteral> strings = literal.strings; 7390 NodeList<StringLiteral> strings = literal.strings;
7393 EngineTestCase.assertSizeOfList(2, strings); 7391 EngineTestCase.assertSizeOfList(2, strings);
7394 StringLiteral firstString = strings[0]; 7392 StringLiteral firstString = strings[0];
7395 StringLiteral secondString = strings[1]; 7393 StringLiteral secondString = strings[1];
7396 JUnitTestCase.assertEquals("a", (firstString as SimpleStringLiteral).value); 7394 expect((firstString as SimpleStringLiteral).value, "a");
7397 JUnitTestCase.assertEquals("b", (secondString as SimpleStringLiteral).value) ; 7395 expect((secondString as SimpleStringLiteral).value, "b");
7398 } 7396 }
7399 7397
7400 void test_parseStringLiteral_interpolated() { 7398 void test_parseStringLiteral_interpolated() {
7401 StringInterpolation literal = ParserTestCase.parse4("parseStringLiteral", "' a \${b} c \$this d'", []); 7399 StringInterpolation literal = ParserTestCase.parse4("parseStringLiteral", "' a \${b} c \$this d'", []);
7402 NodeList<InterpolationElement> elements = literal.elements; 7400 NodeList<InterpolationElement> elements = literal.elements;
7403 EngineTestCase.assertSizeOfList(5, elements); 7401 EngineTestCase.assertSizeOfList(5, elements);
7404 JUnitTestCase.assertTrue(elements[0] is InterpolationString); 7402 expect(elements[0] is InterpolationString, isTrue);
7405 JUnitTestCase.assertTrue(elements[1] is InterpolationExpression); 7403 expect(elements[1] is InterpolationExpression, isTrue);
7406 JUnitTestCase.assertTrue(elements[2] is InterpolationString); 7404 expect(elements[2] is InterpolationString, isTrue);
7407 JUnitTestCase.assertTrue(elements[3] is InterpolationExpression); 7405 expect(elements[3] is InterpolationExpression, isTrue);
7408 JUnitTestCase.assertTrue(elements[4] is InterpolationString); 7406 expect(elements[4] is InterpolationString, isTrue);
7409 } 7407 }
7410 7408
7411 void test_parseStringLiteral_single() { 7409 void test_parseStringLiteral_single() {
7412 SimpleStringLiteral literal = ParserTestCase.parse4("parseStringLiteral", "' a'", []); 7410 SimpleStringLiteral literal = ParserTestCase.parse4("parseStringLiteral", "' a'", []);
7413 JUnitTestCase.assertNotNull(literal.literal); 7411 expect(literal.literal, isNotNull);
7414 JUnitTestCase.assertEquals("a", literal.value); 7412 expect(literal.value, "a");
7415 } 7413 }
7416 7414
7417 void test_parseSuperConstructorInvocation_named() { 7415 void test_parseSuperConstructorInvocation_named() {
7418 SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperCon structorInvocation", "super.a()", []); 7416 SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperCon structorInvocation", "super.a()", []);
7419 JUnitTestCase.assertNotNull(invocation.argumentList); 7417 expect(invocation.argumentList, isNotNull);
7420 JUnitTestCase.assertNotNull(invocation.constructorName); 7418 expect(invocation.constructorName, isNotNull);
7421 JUnitTestCase.assertNotNull(invocation.keyword); 7419 expect(invocation.keyword, isNotNull);
7422 JUnitTestCase.assertNotNull(invocation.period); 7420 expect(invocation.period, isNotNull);
7423 } 7421 }
7424 7422
7425 void test_parseSuperConstructorInvocation_unnamed() { 7423 void test_parseSuperConstructorInvocation_unnamed() {
7426 SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperCon structorInvocation", "super()", []); 7424 SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperCon structorInvocation", "super()", []);
7427 JUnitTestCase.assertNotNull(invocation.argumentList); 7425 expect(invocation.argumentList, isNotNull);
7428 JUnitTestCase.assertNull(invocation.constructorName); 7426 expect(invocation.constructorName, isNull);
7429 JUnitTestCase.assertNotNull(invocation.keyword); 7427 expect(invocation.keyword, isNotNull);
7430 JUnitTestCase.assertNull(invocation.period); 7428 expect(invocation.period, isNull);
7431 } 7429 }
7432 7430
7433 void test_parseSwitchStatement_case() { 7431 void test_parseSwitchStatement_case() {
7434 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';}", []);
7435 JUnitTestCase.assertNotNull(statement.keyword); 7433 expect(statement.keyword, isNotNull);
7436 JUnitTestCase.assertNotNull(statement.leftParenthesis); 7434 expect(statement.leftParenthesis, isNotNull);
7437 JUnitTestCase.assertNotNull(statement.expression); 7435 expect(statement.expression, isNotNull);
7438 JUnitTestCase.assertNotNull(statement.rightParenthesis); 7436 expect(statement.rightParenthesis, isNotNull);
7439 JUnitTestCase.assertNotNull(statement.leftBracket); 7437 expect(statement.leftBracket, isNotNull);
7440 EngineTestCase.assertSizeOfList(1, statement.members); 7438 EngineTestCase.assertSizeOfList(1, statement.members);
7441 JUnitTestCase.assertNotNull(statement.rightBracket); 7439 expect(statement.rightBracket, isNotNull);
7442 } 7440 }
7443 7441
7444 void test_parseSwitchStatement_empty() { 7442 void test_parseSwitchStatement_empty() {
7445 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {}", []); 7443 SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "s witch (a) {}", []);
7446 JUnitTestCase.assertNotNull(statement.keyword); 7444 expect(statement.keyword, isNotNull);
7447 JUnitTestCase.assertNotNull(statement.leftParenthesis); 7445 expect(statement.leftParenthesis, isNotNull);
7448 JUnitTestCase.assertNotNull(statement.expression); 7446 expect(statement.expression, isNotNull);
7449 JUnitTestCase.assertNotNull(statement.rightParenthesis); 7447 expect(statement.rightParenthesis, isNotNull);
7450 JUnitTestCase.assertNotNull(statement.leftBracket); 7448 expect(statement.leftBracket, isNotNull);
7451 EngineTestCase.assertSizeOfList(0, statement.members); 7449 EngineTestCase.assertSizeOfList(0, statement.members);
7452 JUnitTestCase.assertNotNull(statement.rightBracket); 7450 expect(statement.rightBracket, isNotNull);
7453 } 7451 }
7454 7452
7455 void test_parseSwitchStatement_labeledCase() { 7453 void test_parseSwitchStatement_labeledCase() {
7456 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):}", []);
7457 JUnitTestCase.assertNotNull(statement.keyword); 7455 expect(statement.keyword, isNotNull);
7458 JUnitTestCase.assertNotNull(statement.leftParenthesis); 7456 expect(statement.leftParenthesis, isNotNull);
7459 JUnitTestCase.assertNotNull(statement.expression); 7457 expect(statement.expression, isNotNull);
7460 JUnitTestCase.assertNotNull(statement.rightParenthesis); 7458 expect(statement.rightParenthesis, isNotNull);
7461 JUnitTestCase.assertNotNull(statement.leftBracket); 7459 expect(statement.leftBracket, isNotNull);
7462 EngineTestCase.assertSizeOfList(1, statement.members); 7460 EngineTestCase.assertSizeOfList(1, statement.members);
7463 EngineTestCase.assertSizeOfList(3, statement.members[0].labels); 7461 EngineTestCase.assertSizeOfList(3, statement.members[0].labels);
7464 JUnitTestCase.assertNotNull(statement.rightBracket); 7462 expect(statement.rightBracket, isNotNull);
7465 } 7463 }
7466 7464
7467 void test_parseSwitchStatement_labeledStatementInCase() { 7465 void test_parseSwitchStatement_labeledStatementInCase() {
7468 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;}", []);
7469 JUnitTestCase.assertNotNull(statement.keyword); 7467 expect(statement.keyword, isNotNull);
7470 JUnitTestCase.assertNotNull(statement.leftParenthesis); 7468 expect(statement.leftParenthesis, isNotNull);
7471 JUnitTestCase.assertNotNull(statement.expression); 7469 expect(statement.expression, isNotNull);
7472 JUnitTestCase.assertNotNull(statement.rightParenthesis); 7470 expect(statement.rightParenthesis, isNotNull);
7473 JUnitTestCase.assertNotNull(statement.leftBracket); 7471 expect(statement.leftBracket, isNotNull);
7474 EngineTestCase.assertSizeOfList(1, statement.members); 7472 EngineTestCase.assertSizeOfList(1, statement.members);
7475 EngineTestCase.assertSizeOfList(3, statement.members[0].statements); 7473 EngineTestCase.assertSizeOfList(3, statement.members[0].statements);
7476 JUnitTestCase.assertNotNull(statement.rightBracket); 7474 expect(statement.rightBracket, isNotNull);
7477 } 7475 }
7478 7476
7479 void test_parseSymbolLiteral_builtInIdentifier() { 7477 void test_parseSymbolLiteral_builtInIdentifier() {
7480 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#dynami c.static.abstract", []); 7478 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#dynami c.static.abstract", []);
7481 JUnitTestCase.assertNotNull(literal.poundSign); 7479 expect(literal.poundSign, isNotNull);
7482 List<Token> components = literal.components; 7480 List<Token> components = literal.components;
7483 EngineTestCase.assertLength(3, components); 7481 EngineTestCase.assertLength(3, components);
7484 JUnitTestCase.assertEquals("dynamic", components[0].lexeme); 7482 expect(components[0].lexeme, "dynamic");
7485 JUnitTestCase.assertEquals("static", components[1].lexeme); 7483 expect(components[1].lexeme, "static");
7486 JUnitTestCase.assertEquals("abstract", components[2].lexeme); 7484 expect(components[2].lexeme, "abstract");
7487 } 7485 }
7488 7486
7489 void test_parseSymbolLiteral_multiple() { 7487 void test_parseSymbolLiteral_multiple() {
7490 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c" , []); 7488 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c" , []);
7491 JUnitTestCase.assertNotNull(literal.poundSign); 7489 expect(literal.poundSign, isNotNull);
7492 List<Token> components = literal.components; 7490 List<Token> components = literal.components;
7493 EngineTestCase.assertLength(3, components); 7491 EngineTestCase.assertLength(3, components);
7494 JUnitTestCase.assertEquals("a", components[0].lexeme); 7492 expect(components[0].lexeme, "a");
7495 JUnitTestCase.assertEquals("b", components[1].lexeme); 7493 expect(components[1].lexeme, "b");
7496 JUnitTestCase.assertEquals("c", components[2].lexeme); 7494 expect(components[2].lexeme, "c");
7497 } 7495 }
7498 7496
7499 void test_parseSymbolLiteral_operator() { 7497 void test_parseSymbolLiteral_operator() {
7500 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#==", [ ]); 7498 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#==", [ ]);
7501 JUnitTestCase.assertNotNull(literal.poundSign); 7499 expect(literal.poundSign, isNotNull);
7502 List<Token> components = literal.components; 7500 List<Token> components = literal.components;
7503 EngineTestCase.assertLength(1, components); 7501 EngineTestCase.assertLength(1, components);
7504 JUnitTestCase.assertEquals("==", components[0].lexeme); 7502 expect(components[0].lexeme, "==");
7505 } 7503 }
7506 7504
7507 void test_parseSymbolLiteral_single() { 7505 void test_parseSymbolLiteral_single() {
7508 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a", [] ); 7506 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a", [] );
7509 JUnitTestCase.assertNotNull(literal.poundSign); 7507 expect(literal.poundSign, isNotNull);
7510 List<Token> components = literal.components; 7508 List<Token> components = literal.components;
7511 EngineTestCase.assertLength(1, components); 7509 EngineTestCase.assertLength(1, components);
7512 JUnitTestCase.assertEquals("a", components[0].lexeme); 7510 expect(components[0].lexeme, "a");
7513 } 7511 }
7514 7512
7515 void test_parseSymbolLiteral_void() { 7513 void test_parseSymbolLiteral_void() {
7516 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#void", []); 7514 SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#void", []);
7517 JUnitTestCase.assertNotNull(literal.poundSign); 7515 expect(literal.poundSign, isNotNull);
7518 List<Token> components = literal.components; 7516 List<Token> components = literal.components;
7519 EngineTestCase.assertLength(1, components); 7517 EngineTestCase.assertLength(1, components);
7520 JUnitTestCase.assertEquals("void", components[0].lexeme); 7518 expect(components[0].lexeme, "void");
7521 } 7519 }
7522 7520
7523 void test_parseThrowExpression() { 7521 void test_parseThrowExpression() {
7524 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpression", " throw x;", []); 7522 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpression", " throw x;", []);
7525 JUnitTestCase.assertNotNull(expression.keyword); 7523 expect(expression.keyword, isNotNull);
7526 JUnitTestCase.assertNotNull(expression.expression); 7524 expect(expression.expression, isNotNull);
7527 } 7525 }
7528 7526
7529 void test_parseThrowExpressionWithoutCascade() { 7527 void test_parseThrowExpressionWithoutCascade() {
7530 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpressionWith outCascade", "throw x;", []); 7528 ThrowExpression expression = ParserTestCase.parse4("parseThrowExpressionWith outCascade", "throw x;", []);
7531 JUnitTestCase.assertNotNull(expression.keyword); 7529 expect(expression.keyword, isNotNull);
7532 JUnitTestCase.assertNotNull(expression.expression); 7530 expect(expression.expression, isNotNull);
7533 } 7531 }
7534 7532
7535 void test_parseTryStatement_catch() { 7533 void test_parseTryStatement_catch() {
7536 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}", []); 7534 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}", []);
7537 JUnitTestCase.assertNotNull(statement.tryKeyword); 7535 expect(statement.tryKeyword, isNotNull);
7538 JUnitTestCase.assertNotNull(statement.body); 7536 expect(statement.body, isNotNull);
7539 NodeList<CatchClause> catchClauses = statement.catchClauses; 7537 NodeList<CatchClause> catchClauses = statement.catchClauses;
7540 EngineTestCase.assertSizeOfList(1, catchClauses); 7538 EngineTestCase.assertSizeOfList(1, catchClauses);
7541 CatchClause clause = catchClauses[0]; 7539 CatchClause clause = catchClauses[0];
7542 JUnitTestCase.assertNull(clause.onKeyword); 7540 expect(clause.onKeyword, isNull);
7543 JUnitTestCase.assertNull(clause.exceptionType); 7541 expect(clause.exceptionType, isNull);
7544 JUnitTestCase.assertNotNull(clause.catchKeyword); 7542 expect(clause.catchKeyword, isNotNull);
7545 JUnitTestCase.assertNotNull(clause.exceptionParameter); 7543 expect(clause.exceptionParameter, isNotNull);
7546 JUnitTestCase.assertNull(clause.comma); 7544 expect(clause.comma, isNull);
7547 JUnitTestCase.assertNull(clause.stackTraceParameter); 7545 expect(clause.stackTraceParameter, isNull);
7548 JUnitTestCase.assertNotNull(clause.body); 7546 expect(clause.body, isNotNull);
7549 JUnitTestCase.assertNull(statement.finallyKeyword); 7547 expect(statement.finallyKeyword, isNull);
7550 JUnitTestCase.assertNull(statement.finallyBlock); 7548 expect(statement.finallyBlock, isNull);
7551 } 7549 }
7552 7550
7553 void test_parseTryStatement_catch_finally() { 7551 void test_parseTryStatement_catch_finally() {
7554 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e, s) {} finally {}", []); 7552 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e, s) {} finally {}", []);
7555 JUnitTestCase.assertNotNull(statement.tryKeyword); 7553 expect(statement.tryKeyword, isNotNull);
7556 JUnitTestCase.assertNotNull(statement.body); 7554 expect(statement.body, isNotNull);
7557 NodeList<CatchClause> catchClauses = statement.catchClauses; 7555 NodeList<CatchClause> catchClauses = statement.catchClauses;
7558 EngineTestCase.assertSizeOfList(1, catchClauses); 7556 EngineTestCase.assertSizeOfList(1, catchClauses);
7559 CatchClause clause = catchClauses[0]; 7557 CatchClause clause = catchClauses[0];
7560 JUnitTestCase.assertNull(clause.onKeyword); 7558 expect(clause.onKeyword, isNull);
7561 JUnitTestCase.assertNull(clause.exceptionType); 7559 expect(clause.exceptionType, isNull);
7562 JUnitTestCase.assertNotNull(clause.catchKeyword); 7560 expect(clause.catchKeyword, isNotNull);
7563 JUnitTestCase.assertNotNull(clause.exceptionParameter); 7561 expect(clause.exceptionParameter, isNotNull);
7564 JUnitTestCase.assertNotNull(clause.comma); 7562 expect(clause.comma, isNotNull);
7565 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 7563 expect(clause.stackTraceParameter, isNotNull);
7566 JUnitTestCase.assertNotNull(clause.body); 7564 expect(clause.body, isNotNull);
7567 JUnitTestCase.assertNotNull(statement.finallyKeyword); 7565 expect(statement.finallyKeyword, isNotNull);
7568 JUnitTestCase.assertNotNull(statement.finallyBlock); 7566 expect(statement.finallyBlock, isNotNull);
7569 } 7567 }
7570 7568
7571 void test_parseTryStatement_finally() { 7569 void test_parseTryStatement_finally() {
7572 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} finally {}", []); 7570 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} finally {}", []);
7573 JUnitTestCase.assertNotNull(statement.tryKeyword); 7571 expect(statement.tryKeyword, isNotNull);
7574 JUnitTestCase.assertNotNull(statement.body); 7572 expect(statement.body, isNotNull);
7575 EngineTestCase.assertSizeOfList(0, statement.catchClauses); 7573 EngineTestCase.assertSizeOfList(0, statement.catchClauses);
7576 JUnitTestCase.assertNotNull(statement.finallyKeyword); 7574 expect(statement.finallyKeyword, isNotNull);
7577 JUnitTestCase.assertNotNull(statement.finallyBlock); 7575 expect(statement.finallyBlock, isNotNull);
7578 } 7576 }
7579 7577
7580 void test_parseTryStatement_multiple() { 7578 void test_parseTryStatement_multiple() {
7581 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) {}", []);
7582 JUnitTestCase.assertNotNull(statement.tryKeyword); 7580 expect(statement.tryKeyword, isNotNull);
7583 JUnitTestCase.assertNotNull(statement.body); 7581 expect(statement.body, isNotNull);
7584 EngineTestCase.assertSizeOfList(3, statement.catchClauses); 7582 EngineTestCase.assertSizeOfList(3, statement.catchClauses);
7585 JUnitTestCase.assertNull(statement.finallyKeyword); 7583 expect(statement.finallyKeyword, isNull);
7586 JUnitTestCase.assertNull(statement.finallyBlock); 7584 expect(statement.finallyBlock, isNull);
7587 } 7585 }
7588 7586
7589 void test_parseTryStatement_on() { 7587 void test_parseTryStatement_on() {
7590 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error {}", []); 7588 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error {}", []);
7591 JUnitTestCase.assertNotNull(statement.tryKeyword); 7589 expect(statement.tryKeyword, isNotNull);
7592 JUnitTestCase.assertNotNull(statement.body); 7590 expect(statement.body, isNotNull);
7593 NodeList<CatchClause> catchClauses = statement.catchClauses; 7591 NodeList<CatchClause> catchClauses = statement.catchClauses;
7594 EngineTestCase.assertSizeOfList(1, catchClauses); 7592 EngineTestCase.assertSizeOfList(1, catchClauses);
7595 CatchClause clause = catchClauses[0]; 7593 CatchClause clause = catchClauses[0];
7596 JUnitTestCase.assertNotNull(clause.onKeyword); 7594 expect(clause.onKeyword, isNotNull);
7597 JUnitTestCase.assertNotNull(clause.exceptionType); 7595 expect(clause.exceptionType, isNotNull);
7598 JUnitTestCase.assertNull(clause.catchKeyword); 7596 expect(clause.catchKeyword, isNull);
7599 JUnitTestCase.assertNull(clause.exceptionParameter); 7597 expect(clause.exceptionParameter, isNull);
7600 JUnitTestCase.assertNull(clause.comma); 7598 expect(clause.comma, isNull);
7601 JUnitTestCase.assertNull(clause.stackTraceParameter); 7599 expect(clause.stackTraceParameter, isNull);
7602 JUnitTestCase.assertNotNull(clause.body); 7600 expect(clause.body, isNotNull);
7603 JUnitTestCase.assertNull(statement.finallyKeyword); 7601 expect(statement.finallyKeyword, isNull);
7604 JUnitTestCase.assertNull(statement.finallyBlock); 7602 expect(statement.finallyBlock, isNull);
7605 } 7603 }
7606 7604
7607 void test_parseTryStatement_on_catch() { 7605 void test_parseTryStatement_on_catch() {
7608 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}", []); 7606 TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}", []);
7609 JUnitTestCase.assertNotNull(statement.tryKeyword); 7607 expect(statement.tryKeyword, isNotNull);
7610 JUnitTestCase.assertNotNull(statement.body); 7608 expect(statement.body, isNotNull);
7611 NodeList<CatchClause> catchClauses = statement.catchClauses; 7609 NodeList<CatchClause> catchClauses = statement.catchClauses;
7612 EngineTestCase.assertSizeOfList(1, catchClauses); 7610 EngineTestCase.assertSizeOfList(1, catchClauses);
7613 CatchClause clause = catchClauses[0]; 7611 CatchClause clause = catchClauses[0];
7614 JUnitTestCase.assertNotNull(clause.onKeyword); 7612 expect(clause.onKeyword, isNotNull);
7615 JUnitTestCase.assertNotNull(clause.exceptionType); 7613 expect(clause.exceptionType, isNotNull);
7616 JUnitTestCase.assertNotNull(clause.catchKeyword); 7614 expect(clause.catchKeyword, isNotNull);
7617 JUnitTestCase.assertNotNull(clause.exceptionParameter); 7615 expect(clause.exceptionParameter, isNotNull);
7618 JUnitTestCase.assertNotNull(clause.comma); 7616 expect(clause.comma, isNotNull);
7619 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 7617 expect(clause.stackTraceParameter, isNotNull);
7620 JUnitTestCase.assertNotNull(clause.body); 7618 expect(clause.body, isNotNull);
7621 JUnitTestCase.assertNull(statement.finallyKeyword); 7619 expect(statement.finallyKeyword, isNull);
7622 JUnitTestCase.assertNull(statement.finallyBlock); 7620 expect(statement.finallyBlock, isNull);
7623 } 7621 }
7624 7622
7625 void test_parseTryStatement_on_catch_finally() { 7623 void test_parseTryStatement_on_catch_finally() {
7626 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 {}", []);
7627 JUnitTestCase.assertNotNull(statement.tryKeyword); 7625 expect(statement.tryKeyword, isNotNull);
7628 JUnitTestCase.assertNotNull(statement.body); 7626 expect(statement.body, isNotNull);
7629 NodeList<CatchClause> catchClauses = statement.catchClauses; 7627 NodeList<CatchClause> catchClauses = statement.catchClauses;
7630 EngineTestCase.assertSizeOfList(1, catchClauses); 7628 EngineTestCase.assertSizeOfList(1, catchClauses);
7631 CatchClause clause = catchClauses[0]; 7629 CatchClause clause = catchClauses[0];
7632 JUnitTestCase.assertNotNull(clause.onKeyword); 7630 expect(clause.onKeyword, isNotNull);
7633 JUnitTestCase.assertNotNull(clause.exceptionType); 7631 expect(clause.exceptionType, isNotNull);
7634 JUnitTestCase.assertNotNull(clause.catchKeyword); 7632 expect(clause.catchKeyword, isNotNull);
7635 JUnitTestCase.assertNotNull(clause.exceptionParameter); 7633 expect(clause.exceptionParameter, isNotNull);
7636 JUnitTestCase.assertNotNull(clause.comma); 7634 expect(clause.comma, isNotNull);
7637 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 7635 expect(clause.stackTraceParameter, isNotNull);
7638 JUnitTestCase.assertNotNull(clause.body); 7636 expect(clause.body, isNotNull);
7639 JUnitTestCase.assertNotNull(statement.finallyKeyword); 7637 expect(statement.finallyKeyword, isNotNull);
7640 JUnitTestCase.assertNotNull(statement.finallyBlock); 7638 expect(statement.finallyBlock, isNotNull);
7641 } 7639 }
7642 7640
7643 void test_parseTypeAlias_function_noParameters() { 7641 void test_parseTypeAlias_function_noParameters() {
7644 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F();"); 7642 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F();");
7645 JUnitTestCase.assertNotNull(typeAlias.keyword); 7643 expect(typeAlias.keyword, isNotNull);
7646 JUnitTestCase.assertNotNull(typeAlias.name); 7644 expect(typeAlias.name, isNotNull);
7647 JUnitTestCase.assertNotNull(typeAlias.parameters); 7645 expect(typeAlias.parameters, isNotNull);
7648 JUnitTestCase.assertNotNull(typeAlias.returnType); 7646 expect(typeAlias.returnType, isNotNull);
7649 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7647 expect(typeAlias.semicolon, isNotNull);
7650 JUnitTestCase.assertNull(typeAlias.typeParameters); 7648 expect(typeAlias.typeParameters, isNull);
7651 } 7649 }
7652 7650
7653 void test_parseTypeAlias_function_noReturnType() { 7651 void test_parseTypeAlias_function_noReturnType() {
7654 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef F();"); 7652 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef F();");
7655 JUnitTestCase.assertNotNull(typeAlias.keyword); 7653 expect(typeAlias.keyword, isNotNull);
7656 JUnitTestCase.assertNotNull(typeAlias.name); 7654 expect(typeAlias.name, isNotNull);
7657 JUnitTestCase.assertNotNull(typeAlias.parameters); 7655 expect(typeAlias.parameters, isNotNull);
7658 JUnitTestCase.assertNull(typeAlias.returnType); 7656 expect(typeAlias.returnType, isNull);
7659 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7657 expect(typeAlias.semicolon, isNotNull);
7660 JUnitTestCase.assertNull(typeAlias.typeParameters); 7658 expect(typeAlias.typeParameters, isNull);
7661 } 7659 }
7662 7660
7663 void test_parseTypeAlias_function_parameterizedReturnType() { 7661 void test_parseTypeAlias_function_parameterizedReturnType() {
7664 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef A<B> F();"); 7662 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef A<B> F();");
7665 JUnitTestCase.assertNotNull(typeAlias.keyword); 7663 expect(typeAlias.keyword, isNotNull);
7666 JUnitTestCase.assertNotNull(typeAlias.name); 7664 expect(typeAlias.name, isNotNull);
7667 JUnitTestCase.assertNotNull(typeAlias.parameters); 7665 expect(typeAlias.parameters, isNotNull);
7668 JUnitTestCase.assertNotNull(typeAlias.returnType); 7666 expect(typeAlias.returnType, isNotNull);
7669 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7667 expect(typeAlias.semicolon, isNotNull);
7670 JUnitTestCase.assertNull(typeAlias.typeParameters); 7668 expect(typeAlias.typeParameters, isNull);
7671 } 7669 }
7672 7670
7673 void test_parseTypeAlias_function_parameters() { 7671 void test_parseTypeAlias_function_parameters() {
7674 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F(Object value);"); 7672 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F(Object value);");
7675 JUnitTestCase.assertNotNull(typeAlias.keyword); 7673 expect(typeAlias.keyword, isNotNull);
7676 JUnitTestCase.assertNotNull(typeAlias.name); 7674 expect(typeAlias.name, isNotNull);
7677 JUnitTestCase.assertNotNull(typeAlias.parameters); 7675 expect(typeAlias.parameters, isNotNull);
7678 JUnitTestCase.assertNotNull(typeAlias.returnType); 7676 expect(typeAlias.returnType, isNotNull);
7679 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7677 expect(typeAlias.semicolon, isNotNull);
7680 JUnitTestCase.assertNull(typeAlias.typeParameters); 7678 expect(typeAlias.typeParameters, isNull);
7681 } 7679 }
7682 7680
7683 void test_parseTypeAlias_function_typeParameters() { 7681 void test_parseTypeAlias_function_typeParameters() {
7684 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F<E>();"); 7682 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F<E>();");
7685 JUnitTestCase.assertNotNull(typeAlias.keyword); 7683 expect(typeAlias.keyword, isNotNull);
7686 JUnitTestCase.assertNotNull(typeAlias.name); 7684 expect(typeAlias.name, isNotNull);
7687 JUnitTestCase.assertNotNull(typeAlias.parameters); 7685 expect(typeAlias.parameters, isNotNull);
7688 JUnitTestCase.assertNotNull(typeAlias.returnType); 7686 expect(typeAlias.returnType, isNotNull);
7689 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7687 expect(typeAlias.semicolon, isNotNull);
7690 JUnitTestCase.assertNotNull(typeAlias.typeParameters); 7688 expect(typeAlias.typeParameters, isNotNull);
7691 } 7689 }
7692 7690
7693 void test_parseTypeAlias_function_voidReturnType() { 7691 void test_parseTypeAlias_function_voidReturnType() {
7694 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef void F();"); 7692 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef void F();");
7695 JUnitTestCase.assertNotNull(typeAlias.keyword); 7693 expect(typeAlias.keyword, isNotNull);
7696 JUnitTestCase.assertNotNull(typeAlias.name); 7694 expect(typeAlias.name, isNotNull);
7697 JUnitTestCase.assertNotNull(typeAlias.parameters); 7695 expect(typeAlias.parameters, isNotNull);
7698 JUnitTestCase.assertNotNull(typeAlias.returnType); 7696 expect(typeAlias.returnType, isNotNull);
7699 JUnitTestCase.assertNotNull(typeAlias.semicolon); 7697 expect(typeAlias.semicolon, isNotNull);
7700 JUnitTestCase.assertNull(typeAlias.typeParameters); 7698 expect(typeAlias.typeParameters, isNull);
7701 } 7699 }
7702 7700
7703 void test_parseTypeArgumentList_multiple() { 7701 void test_parseTypeArgumentList_multiple() {
7704 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int, int, int>", []); 7702 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int, int, int>", []);
7705 JUnitTestCase.assertNotNull(argumentList.leftBracket); 7703 expect(argumentList.leftBracket, isNotNull);
7706 EngineTestCase.assertSizeOfList(3, argumentList.arguments); 7704 EngineTestCase.assertSizeOfList(3, argumentList.arguments);
7707 JUnitTestCase.assertNotNull(argumentList.rightBracket); 7705 expect(argumentList.rightBracket, isNotNull);
7708 } 7706 }
7709 7707
7710 void test_parseTypeArgumentList_nested() { 7708 void test_parseTypeArgumentList_nested() {
7711 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<A<B>>", []); 7709 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<A<B>>", []);
7712 JUnitTestCase.assertNotNull(argumentList.leftBracket); 7710 expect(argumentList.leftBracket, isNotNull);
7713 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 7711 EngineTestCase.assertSizeOfList(1, argumentList.arguments);
7714 TypeName argument = argumentList.arguments[0]; 7712 TypeName argument = argumentList.arguments[0];
7715 JUnitTestCase.assertNotNull(argument); 7713 expect(argument, isNotNull);
7716 TypeArgumentList innerList = argument.typeArguments; 7714 TypeArgumentList innerList = argument.typeArguments;
7717 JUnitTestCase.assertNotNull(innerList); 7715 expect(innerList, isNotNull);
7718 EngineTestCase.assertSizeOfList(1, innerList.arguments); 7716 EngineTestCase.assertSizeOfList(1, innerList.arguments);
7719 JUnitTestCase.assertNotNull(argumentList.rightBracket); 7717 expect(argumentList.rightBracket, isNotNull);
7720 } 7718 }
7721 7719
7722 void test_parseTypeArgumentList_single() { 7720 void test_parseTypeArgumentList_single() {
7723 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int>", []); 7721 TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList ", "<int>", []);
7724 JUnitTestCase.assertNotNull(argumentList.leftBracket); 7722 expect(argumentList.leftBracket, isNotNull);
7725 EngineTestCase.assertSizeOfList(1, argumentList.arguments); 7723 EngineTestCase.assertSizeOfList(1, argumentList.arguments);
7726 JUnitTestCase.assertNotNull(argumentList.rightBracket); 7724 expect(argumentList.rightBracket, isNotNull);
7727 } 7725 }
7728 7726
7729 void test_parseTypeName_parameterized() { 7727 void test_parseTypeName_parameterized() {
7730 TypeName typeName = ParserTestCase.parse4("parseTypeName", "List<int>", []); 7728 TypeName typeName = ParserTestCase.parse4("parseTypeName", "List<int>", []);
7731 JUnitTestCase.assertNotNull(typeName.name); 7729 expect(typeName.name, isNotNull);
7732 JUnitTestCase.assertNotNull(typeName.typeArguments); 7730 expect(typeName.typeArguments, isNotNull);
7733 } 7731 }
7734 7732
7735 void test_parseTypeName_simple() { 7733 void test_parseTypeName_simple() {
7736 TypeName typeName = ParserTestCase.parse4("parseTypeName", "int", []); 7734 TypeName typeName = ParserTestCase.parse4("parseTypeName", "int", []);
7737 JUnitTestCase.assertNotNull(typeName.name); 7735 expect(typeName.name, isNotNull);
7738 JUnitTestCase.assertNull(typeName.typeArguments); 7736 expect(typeName.typeArguments, isNull);
7739 } 7737 }
7740 7738
7741 void test_parseTypeParameter_bounded() { 7739 void test_parseTypeParameter_bounded() {
7742 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A ext ends B", []); 7740 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A ext ends B", []);
7743 JUnitTestCase.assertNotNull(parameter.bound); 7741 expect(parameter.bound, isNotNull);
7744 JUnitTestCase.assertNotNull(parameter.keyword); 7742 expect(parameter.keyword, isNotNull);
7745 JUnitTestCase.assertNotNull(parameter.name); 7743 expect(parameter.name, isNotNull);
7746 } 7744 }
7747 7745
7748 void test_parseTypeParameter_simple() { 7746 void test_parseTypeParameter_simple() {
7749 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A", [ ]); 7747 TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A", [ ]);
7750 JUnitTestCase.assertNull(parameter.bound); 7748 expect(parameter.bound, isNull);
7751 JUnitTestCase.assertNull(parameter.keyword); 7749 expect(parameter.keyword, isNull);
7752 JUnitTestCase.assertNotNull(parameter.name); 7750 expect(parameter.name, isNotNull);
7753 } 7751 }
7754 7752
7755 void test_parseTypeParameterList_multiple() { 7753 void test_parseTypeParameterList_multiple() {
7756 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A, B extends C, D>", []); 7754 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A, B extends C, D>", []);
7757 JUnitTestCase.assertNotNull(parameterList.leftBracket); 7755 expect(parameterList.leftBracket, isNotNull);
7758 JUnitTestCase.assertNotNull(parameterList.rightBracket); 7756 expect(parameterList.rightBracket, isNotNull);
7759 EngineTestCase.assertSizeOfList(3, parameterList.typeParameters); 7757 EngineTestCase.assertSizeOfList(3, parameterList.typeParameters);
7760 } 7758 }
7761 7759
7762 void test_parseTypeParameterList_parameterizedWithTrailingEquals() { 7760 void test_parseTypeParameterList_parameterizedWithTrailingEquals() {
7763 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A extends B<E>>=", []); 7761 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A extends B<E>>=", []);
7764 JUnitTestCase.assertNotNull(parameterList.leftBracket); 7762 expect(parameterList.leftBracket, isNotNull);
7765 JUnitTestCase.assertNotNull(parameterList.rightBracket); 7763 expect(parameterList.rightBracket, isNotNull);
7766 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7764 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters);
7767 } 7765 }
7768 7766
7769 void test_parseTypeParameterList_single() { 7767 void test_parseTypeParameterList_single() {
7770 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>", []); 7768 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>", []);
7771 JUnitTestCase.assertNotNull(parameterList.leftBracket); 7769 expect(parameterList.leftBracket, isNotNull);
7772 JUnitTestCase.assertNotNull(parameterList.rightBracket); 7770 expect(parameterList.rightBracket, isNotNull);
7773 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7771 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters);
7774 } 7772 }
7775 7773
7776 void test_parseTypeParameterList_withTrailingEquals() { 7774 void test_parseTypeParameterList_withTrailingEquals() {
7777 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>=", []); 7775 TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterL ist", "<A>=", []);
7778 JUnitTestCase.assertNotNull(parameterList.leftBracket); 7776 expect(parameterList.leftBracket, isNotNull);
7779 JUnitTestCase.assertNotNull(parameterList.rightBracket); 7777 expect(parameterList.rightBracket, isNotNull);
7780 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters); 7778 EngineTestCase.assertSizeOfList(1, parameterList.typeParameters);
7781 } 7779 }
7782 7780
7783 void test_parseUnaryExpression_decrement_normal() { 7781 void test_parseUnaryExpression_decrement_normal() {
7784 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--x", []); 7782 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--x", []);
7785 JUnitTestCase.assertNotNull(expression.operator); 7783 expect(expression.operator, isNotNull);
7786 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 7784 expect(expression.operator.type, TokenType.MINUS_MINUS);
7787 JUnitTestCase.assertNotNull(expression.operand); 7785 expect(expression.operand, isNotNull);
7788 } 7786 }
7789 7787
7790 void test_parseUnaryExpression_decrement_super() { 7788 void test_parseUnaryExpression_decrement_super() {
7791 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--super", []); 7789 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--super", []);
7792 JUnitTestCase.assertNotNull(expression.operator); 7790 expect(expression.operator, isNotNull);
7793 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 7791 expect(expression.operator.type, TokenType.MINUS);
7794 Expression innerExpression = expression.operand; 7792 Expression innerExpression = expression.operand;
7795 JUnitTestCase.assertNotNull(innerExpression); 7793 expect(innerExpression, isNotNull);
7796 JUnitTestCase.assertTrue(innerExpression is PrefixExpression); 7794 expect(innerExpression is PrefixExpression, isTrue);
7797 PrefixExpression operand = innerExpression as PrefixExpression; 7795 PrefixExpression operand = innerExpression as PrefixExpression;
7798 JUnitTestCase.assertNotNull(operand.operator); 7796 expect(operand.operator, isNotNull);
7799 JUnitTestCase.assertEquals(TokenType.MINUS, operand.operator.type); 7797 expect(operand.operator.type, TokenType.MINUS);
7800 JUnitTestCase.assertNotNull(operand.operand); 7798 expect(operand.operand, isNotNull);
7801 } 7799 }
7802 7800
7803 void test_parseUnaryExpression_decrement_super_propertyAccess() { 7801 void test_parseUnaryExpression_decrement_super_propertyAccess() {
7804 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--super.x", []); 7802 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--super.x", []);
7805 JUnitTestCase.assertNotNull(expression.operator); 7803 expect(expression.operator, isNotNull);
7806 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 7804 expect(expression.operator.type, TokenType.MINUS_MINUS);
7807 JUnitTestCase.assertNotNull(expression.operand); 7805 expect(expression.operand, isNotNull);
7808 PropertyAccess operand = expression.operand as PropertyAccess; 7806 PropertyAccess operand = expression.operand as PropertyAccess;
7809 JUnitTestCase.assertTrue(operand.target is SuperExpression); 7807 expect(operand.target is SuperExpression, isTrue);
7810 JUnitTestCase.assertEquals("x", operand.propertyName.name); 7808 expect(operand.propertyName.name, "x");
7811 } 7809 }
7812 7810
7813 void test_parseUnaryExpression_increment_normal() { 7811 void test_parseUnaryExpression_increment_normal() {
7814 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++x", []); 7812 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++x", []);
7815 JUnitTestCase.assertNotNull(expression.operator); 7813 expect(expression.operator, isNotNull);
7816 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 7814 expect(expression.operator.type, TokenType.PLUS_PLUS);
7817 JUnitTestCase.assertNotNull(expression.operand); 7815 expect(expression.operand, isNotNull);
7818 } 7816 }
7819 7817
7820 void test_parseUnaryExpression_increment_super_index() { 7818 void test_parseUnaryExpression_increment_super_index() {
7821 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++super[0]", []); 7819 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++super[0]", []);
7822 JUnitTestCase.assertNotNull(expression.operator); 7820 expect(expression.operator, isNotNull);
7823 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 7821 expect(expression.operator.type, TokenType.PLUS_PLUS);
7824 JUnitTestCase.assertNotNull(expression.operand); 7822 expect(expression.operand, isNotNull);
7825 IndexExpression operand = expression.operand as IndexExpression; 7823 IndexExpression operand = expression.operand as IndexExpression;
7826 JUnitTestCase.assertTrue(operand.realTarget is SuperExpression); 7824 expect(operand.realTarget is SuperExpression, isTrue);
7827 JUnitTestCase.assertTrue(operand.index is IntegerLiteral); 7825 expect(operand.index is IntegerLiteral, isTrue);
7828 } 7826 }
7829 7827
7830 void test_parseUnaryExpression_increment_super_propertyAccess() { 7828 void test_parseUnaryExpression_increment_super_propertyAccess() {
7831 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++super.x", []); 7829 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++super.x", []);
7832 JUnitTestCase.assertNotNull(expression.operator); 7830 expect(expression.operator, isNotNull);
7833 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 7831 expect(expression.operator.type, TokenType.PLUS_PLUS);
7834 JUnitTestCase.assertNotNull(expression.operand); 7832 expect(expression.operand, isNotNull);
7835 PropertyAccess operand = expression.operand as PropertyAccess; 7833 PropertyAccess operand = expression.operand as PropertyAccess;
7836 JUnitTestCase.assertTrue(operand.target is SuperExpression); 7834 expect(operand.target is SuperExpression, isTrue);
7837 JUnitTestCase.assertEquals("x", operand.propertyName.name); 7835 expect(operand.propertyName.name, "x");
7838 } 7836 }
7839 7837
7840 void test_parseUnaryExpression_minus_normal() { 7838 void test_parseUnaryExpression_minus_normal() {
7841 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "-x", []); 7839 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "-x", []);
7842 JUnitTestCase.assertNotNull(expression.operator); 7840 expect(expression.operator, isNotNull);
7843 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 7841 expect(expression.operator.type, TokenType.MINUS);
7844 JUnitTestCase.assertNotNull(expression.operand); 7842 expect(expression.operand, isNotNull);
7845 } 7843 }
7846 7844
7847 void test_parseUnaryExpression_minus_super() { 7845 void test_parseUnaryExpression_minus_super() {
7848 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "-super", []); 7846 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "-super", []);
7849 JUnitTestCase.assertNotNull(expression.operator); 7847 expect(expression.operator, isNotNull);
7850 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 7848 expect(expression.operator.type, TokenType.MINUS);
7851 JUnitTestCase.assertNotNull(expression.operand); 7849 expect(expression.operand, isNotNull);
7852 } 7850 }
7853 7851
7854 void test_parseUnaryExpression_not_normal() { 7852 void test_parseUnaryExpression_not_normal() {
7855 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "!x", []); 7853 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "!x", []);
7856 JUnitTestCase.assertNotNull(expression.operator); 7854 expect(expression.operator, isNotNull);
7857 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type); 7855 expect(expression.operator.type, TokenType.BANG);
7858 JUnitTestCase.assertNotNull(expression.operand); 7856 expect(expression.operand, isNotNull);
7859 } 7857 }
7860 7858
7861 void test_parseUnaryExpression_not_super() { 7859 void test_parseUnaryExpression_not_super() {
7862 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "!super", []); 7860 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "!super", []);
7863 JUnitTestCase.assertNotNull(expression.operator); 7861 expect(expression.operator, isNotNull);
7864 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type); 7862 expect(expression.operator.type, TokenType.BANG);
7865 JUnitTestCase.assertNotNull(expression.operand); 7863 expect(expression.operand, isNotNull);
7866 } 7864 }
7867 7865
7868 void test_parseUnaryExpression_tilda_normal() { 7866 void test_parseUnaryExpression_tilda_normal() {
7869 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "~x", []); 7867 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "~x", []);
7870 JUnitTestCase.assertNotNull(expression.operator); 7868 expect(expression.operator, isNotNull);
7871 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type); 7869 expect(expression.operator.type, TokenType.TILDE);
7872 JUnitTestCase.assertNotNull(expression.operand); 7870 expect(expression.operand, isNotNull);
7873 } 7871 }
7874 7872
7875 void test_parseUnaryExpression_tilda_super() { 7873 void test_parseUnaryExpression_tilda_super() {
7876 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "~super", []); 7874 PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "~super", []);
7877 JUnitTestCase.assertNotNull(expression.operator); 7875 expect(expression.operator, isNotNull);
7878 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type); 7876 expect(expression.operator.type, TokenType.TILDE);
7879 JUnitTestCase.assertNotNull(expression.operand); 7877 expect(expression.operand, isNotNull);
7880 } 7878 }
7881 7879
7882 void test_parseVariableDeclaration_equals() { 7880 void test_parseVariableDeclaration_equals() {
7883 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a = b", []); 7881 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a = b", []);
7884 JUnitTestCase.assertNotNull(declaration.name); 7882 expect(declaration.name, isNotNull);
7885 JUnitTestCase.assertNotNull(declaration.equals); 7883 expect(declaration.equals, isNotNull);
7886 JUnitTestCase.assertNotNull(declaration.initializer); 7884 expect(declaration.initializer, isNotNull);
7887 } 7885 }
7888 7886
7889 void test_parseVariableDeclaration_noEquals() { 7887 void test_parseVariableDeclaration_noEquals() {
7890 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a", []); 7888 VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclar ation", "a", []);
7891 JUnitTestCase.assertNotNull(declaration.name); 7889 expect(declaration.name, isNotNull);
7892 JUnitTestCase.assertNull(declaration.equals); 7890 expect(declaration.equals, isNull);
7893 JUnitTestCase.assertNull(declaration.initializer); 7891 expect(declaration.initializer, isNull);
7894 } 7892 }
7895 7893
7896 void test_parseVariableDeclarationListAfterMetadata_const_noType() { 7894 void test_parseVariableDeclarationListAfterMetadata_const_noType() {
7897 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const a") ; 7895 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const a") ;
7898 JUnitTestCase.assertNotNull(declarationList.keyword); 7896 expect(declarationList.keyword, isNotNull);
7899 JUnitTestCase.assertNull(declarationList.type); 7897 expect(declarationList.type, isNull);
7900 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7898 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7901 } 7899 }
7902 7900
7903 void test_parseVariableDeclarationListAfterMetadata_const_type() { 7901 void test_parseVariableDeclarationListAfterMetadata_const_type() {
7904 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const A a "); 7902 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "const A a ");
7905 JUnitTestCase.assertNotNull(declarationList.keyword); 7903 expect(declarationList.keyword, isNotNull);
7906 JUnitTestCase.assertNotNull(declarationList.type); 7904 expect(declarationList.type, isNotNull);
7907 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7905 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7908 } 7906 }
7909 7907
7910 void test_parseVariableDeclarationListAfterMetadata_final_noType() { 7908 void test_parseVariableDeclarationListAfterMetadata_final_noType() {
7911 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final a") ; 7909 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final a") ;
7912 JUnitTestCase.assertNotNull(declarationList.keyword); 7910 expect(declarationList.keyword, isNotNull);
7913 JUnitTestCase.assertNull(declarationList.type); 7911 expect(declarationList.type, isNull);
7914 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7912 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7915 } 7913 }
7916 7914
7917 void test_parseVariableDeclarationListAfterMetadata_final_type() { 7915 void test_parseVariableDeclarationListAfterMetadata_final_type() {
7918 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final A a "); 7916 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "final A a ");
7919 JUnitTestCase.assertNotNull(declarationList.keyword); 7917 expect(declarationList.keyword, isNotNull);
7920 JUnitTestCase.assertNotNull(declarationList.type); 7918 expect(declarationList.type, isNotNull);
7921 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7919 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7922 } 7920 }
7923 7921
7924 void test_parseVariableDeclarationListAfterMetadata_type_multiple() { 7922 void test_parseVariableDeclarationListAfterMetadata_type_multiple() {
7925 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 ");
7926 JUnitTestCase.assertNull(declarationList.keyword); 7924 expect(declarationList.keyword, isNull);
7927 JUnitTestCase.assertNotNull(declarationList.type); 7925 expect(declarationList.type, isNotNull);
7928 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7926 EngineTestCase.assertSizeOfList(3, declarationList.variables);
7929 } 7927 }
7930 7928
7931 void test_parseVariableDeclarationListAfterMetadata_type_single() { 7929 void test_parseVariableDeclarationListAfterMetadata_type_single() {
7932 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a"); 7930 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "A a");
7933 JUnitTestCase.assertNull(declarationList.keyword); 7931 expect(declarationList.keyword, isNull);
7934 JUnitTestCase.assertNotNull(declarationList.type); 7932 expect(declarationList.type, isNotNull);
7935 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7933 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7936 } 7934 }
7937 7935
7938 void test_parseVariableDeclarationListAfterMetadata_var_multiple() { 7936 void test_parseVariableDeclarationListAfterMetadata_var_multiple() {
7939 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");
7940 JUnitTestCase.assertNotNull(declarationList.keyword); 7938 expect(declarationList.keyword, isNotNull);
7941 JUnitTestCase.assertNull(declarationList.type); 7939 expect(declarationList.type, isNull);
7942 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7940 EngineTestCase.assertSizeOfList(3, declarationList.variables);
7943 } 7941 }
7944 7942
7945 void test_parseVariableDeclarationListAfterMetadata_var_single() { 7943 void test_parseVariableDeclarationListAfterMetadata_var_single() {
7946 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a"); 7944 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterMetadata", <Object> [emptyCommentAndMetadata()], "var a");
7947 JUnitTestCase.assertNotNull(declarationList.keyword); 7945 expect(declarationList.keyword, isNotNull);
7948 JUnitTestCase.assertNull(declarationList.type); 7946 expect(declarationList.type, isNull);
7949 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7947 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7950 } 7948 }
7951 7949
7952 void test_parseVariableDeclarationListAfterType_type() { 7950 void test_parseVariableDeclarationListAfterType_type() {
7953 TypeName type = new TypeName(new SimpleIdentifier(null), null); 7951 TypeName type = new TypeName(new SimpleIdentifier(null), null);
7954 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), null, type], "a "); 7952 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), null, type], "a ");
7955 JUnitTestCase.assertNull(declarationList.keyword); 7953 expect(declarationList.keyword, isNull);
7956 JUnitTestCase.assertEquals(type, declarationList.type); 7954 expect(declarationList.type, type);
7957 EngineTestCase.assertSizeOfList(1, declarationList.variables); 7955 EngineTestCase.assertSizeOfList(1, declarationList.variables);
7958 } 7956 }
7959 7957
7960 void test_parseVariableDeclarationListAfterType_var() { 7958 void test_parseVariableDeclarationListAfterType_var() {
7961 Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR); 7959 Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
7962 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");
7963 JUnitTestCase.assertEquals(keyword, declarationList.keyword); 7961 expect(declarationList.keyword, keyword);
7964 JUnitTestCase.assertNull(declarationList.type); 7962 expect(declarationList.type, isNull);
7965 EngineTestCase.assertSizeOfList(3, declarationList.variables); 7963 EngineTestCase.assertSizeOfList(3, declarationList.variables);
7966 } 7964 }
7967 7965
7968 void test_parseVariableDeclarationStatementAfterMetadata_multiple() { 7966 void test_parseVariableDeclarationStatementAfterMetadata_multiple() {
7969 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;");
7970 JUnitTestCase.assertNotNull(statement.semicolon); 7968 expect(statement.semicolon, isNotNull);
7971 VariableDeclarationList variableList = statement.variables; 7969 VariableDeclarationList variableList = statement.variables;
7972 JUnitTestCase.assertNotNull(variableList); 7970 expect(variableList, isNotNull);
7973 EngineTestCase.assertSizeOfList(3, variableList.variables); 7971 EngineTestCase.assertSizeOfList(3, variableList.variables);
7974 } 7972 }
7975 7973
7976 void test_parseVariableDeclarationStatementAfterMetadata_single() { 7974 void test_parseVariableDeclarationStatementAfterMetadata_single() {
7977 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x ;"); 7975 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x ;");
7978 JUnitTestCase.assertNotNull(statement.semicolon); 7976 expect(statement.semicolon, isNotNull);
7979 VariableDeclarationList variableList = statement.variables; 7977 VariableDeclarationList variableList = statement.variables;
7980 JUnitTestCase.assertNotNull(variableList); 7978 expect(variableList, isNotNull);
7981 EngineTestCase.assertSizeOfList(1, variableList.variables); 7979 EngineTestCase.assertSizeOfList(1, variableList.variables);
7982 } 7980 }
7983 7981
7984 void test_parseWhileStatement() { 7982 void test_parseWhileStatement() {
7985 WhileStatement statement = ParserTestCase.parse4("parseWhileStatement", "whi le (x) {}", []); 7983 WhileStatement statement = ParserTestCase.parse4("parseWhileStatement", "whi le (x) {}", []);
7986 JUnitTestCase.assertNotNull(statement.keyword); 7984 expect(statement.keyword, isNotNull);
7987 JUnitTestCase.assertNotNull(statement.leftParenthesis); 7985 expect(statement.leftParenthesis, isNotNull);
7988 JUnitTestCase.assertNotNull(statement.condition); 7986 expect(statement.condition, isNotNull);
7989 JUnitTestCase.assertNotNull(statement.rightParenthesis); 7987 expect(statement.rightParenthesis, isNotNull);
7990 JUnitTestCase.assertNotNull(statement.body); 7988 expect(statement.body, isNotNull);
7991 } 7989 }
7992 7990
7993 void test_parseWithClause_multiple() { 7991 void test_parseWithClause_multiple() {
7994 WithClause clause = ParserTestCase.parse4("parseWithClause", "with A, B, C", []); 7992 WithClause clause = ParserTestCase.parse4("parseWithClause", "with A, B, C", []);
7995 JUnitTestCase.assertNotNull(clause.withKeyword); 7993 expect(clause.withKeyword, isNotNull);
7996 EngineTestCase.assertSizeOfList(3, clause.mixinTypes); 7994 EngineTestCase.assertSizeOfList(3, clause.mixinTypes);
7997 } 7995 }
7998 7996
7999 void test_parseWithClause_single() { 7997 void test_parseWithClause_single() {
8000 WithClause clause = ParserTestCase.parse4("parseWithClause", "with M", []); 7998 WithClause clause = ParserTestCase.parse4("parseWithClause", "with M", []);
8001 JUnitTestCase.assertNotNull(clause.withKeyword); 7999 expect(clause.withKeyword, isNotNull);
8002 EngineTestCase.assertSizeOfList(1, clause.mixinTypes); 8000 EngineTestCase.assertSizeOfList(1, clause.mixinTypes);
8003 } 8001 }
8004 8002
8005 void test_parseYieldStatement_each() { 8003 void test_parseYieldStatement_each() {
8006 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld* x;", []); 8004 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld* x;", []);
8007 JUnitTestCase.assertNotNull(statement.yieldKeyword); 8005 expect(statement.yieldKeyword, isNotNull);
8008 JUnitTestCase.assertNotNull(statement.star); 8006 expect(statement.star, isNotNull);
8009 JUnitTestCase.assertNotNull(statement.expression); 8007 expect(statement.expression, isNotNull);
8010 JUnitTestCase.assertNotNull(statement.semicolon); 8008 expect(statement.semicolon, isNotNull);
8011 } 8009 }
8012 8010
8013 void test_parseYieldStatement_normal() { 8011 void test_parseYieldStatement_normal() {
8014 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld x;", []); 8012 YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yie ld x;", []);
8015 JUnitTestCase.assertNotNull(statement.yieldKeyword); 8013 expect(statement.yieldKeyword, isNotNull);
8016 JUnitTestCase.assertNull(statement.star); 8014 expect(statement.star, isNull);
8017 JUnitTestCase.assertNotNull(statement.expression); 8015 expect(statement.expression, isNotNull);
8018 JUnitTestCase.assertNotNull(statement.semicolon); 8016 expect(statement.semicolon, isNotNull);
8019 } 8017 }
8020 8018
8021 void test_skipPrefixedIdentifier_invalid() { 8019 void test_skipPrefixedIdentifier_invalid() {
8022 Token following = _skip("skipPrefixedIdentifier", "+"); 8020 Token following = _skip("skipPrefixedIdentifier", "+");
8023 JUnitTestCase.assertNull(following); 8021 expect(following, isNull);
8024 } 8022 }
8025 8023
8026 void test_skipPrefixedIdentifier_notPrefixed() { 8024 void test_skipPrefixedIdentifier_notPrefixed() {
8027 Token following = _skip("skipPrefixedIdentifier", "a +"); 8025 Token following = _skip("skipPrefixedIdentifier", "a +");
8028 JUnitTestCase.assertNotNull(following); 8026 expect(following, isNotNull);
8029 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8027 expect(following.type, TokenType.PLUS);
8030 } 8028 }
8031 8029
8032 void test_skipPrefixedIdentifier_prefixed() { 8030 void test_skipPrefixedIdentifier_prefixed() {
8033 Token following = _skip("skipPrefixedIdentifier", "a.b +"); 8031 Token following = _skip("skipPrefixedIdentifier", "a.b +");
8034 JUnitTestCase.assertNotNull(following); 8032 expect(following, isNotNull);
8035 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8033 expect(following.type, TokenType.PLUS);
8036 } 8034 }
8037 8035
8038 void test_skipReturnType_invalid() { 8036 void test_skipReturnType_invalid() {
8039 Token following = _skip("skipReturnType", "+"); 8037 Token following = _skip("skipReturnType", "+");
8040 JUnitTestCase.assertNull(following); 8038 expect(following, isNull);
8041 } 8039 }
8042 8040
8043 void test_skipReturnType_type() { 8041 void test_skipReturnType_type() {
8044 Token following = _skip("skipReturnType", "C +"); 8042 Token following = _skip("skipReturnType", "C +");
8045 JUnitTestCase.assertNotNull(following); 8043 expect(following, isNotNull);
8046 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8044 expect(following.type, TokenType.PLUS);
8047 } 8045 }
8048 8046
8049 void test_skipReturnType_void() { 8047 void test_skipReturnType_void() {
8050 Token following = _skip("skipReturnType", "void +"); 8048 Token following = _skip("skipReturnType", "void +");
8051 JUnitTestCase.assertNotNull(following); 8049 expect(following, isNotNull);
8052 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8050 expect(following.type, TokenType.PLUS);
8053 } 8051 }
8054 8052
8055 void test_skipSimpleIdentifier_identifier() { 8053 void test_skipSimpleIdentifier_identifier() {
8056 Token following = _skip("skipSimpleIdentifier", "i +"); 8054 Token following = _skip("skipSimpleIdentifier", "i +");
8057 JUnitTestCase.assertNotNull(following); 8055 expect(following, isNotNull);
8058 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8056 expect(following.type, TokenType.PLUS);
8059 } 8057 }
8060 8058
8061 void test_skipSimpleIdentifier_invalid() { 8059 void test_skipSimpleIdentifier_invalid() {
8062 Token following = _skip("skipSimpleIdentifier", "9 +"); 8060 Token following = _skip("skipSimpleIdentifier", "9 +");
8063 JUnitTestCase.assertNull(following); 8061 expect(following, isNull);
8064 } 8062 }
8065 8063
8066 void test_skipSimpleIdentifier_pseudoKeyword() { 8064 void test_skipSimpleIdentifier_pseudoKeyword() {
8067 Token following = _skip("skipSimpleIdentifier", "as +"); 8065 Token following = _skip("skipSimpleIdentifier", "as +");
8068 JUnitTestCase.assertNotNull(following); 8066 expect(following, isNotNull);
8069 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8067 expect(following.type, TokenType.PLUS);
8070 } 8068 }
8071 8069
8072 void test_skipStringLiteral_adjacent() { 8070 void test_skipStringLiteral_adjacent() {
8073 Token following = _skip("skipStringLiteral", "'a' 'b' +"); 8071 Token following = _skip("skipStringLiteral", "'a' 'b' +");
8074 JUnitTestCase.assertNotNull(following); 8072 expect(following, isNotNull);
8075 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8073 expect(following.type, TokenType.PLUS);
8076 } 8074 }
8077 8075
8078 void test_skipStringLiteral_interpolated() { 8076 void test_skipStringLiteral_interpolated() {
8079 Token following = _skip("skipStringLiteral", "'a\${b}c' +"); 8077 Token following = _skip("skipStringLiteral", "'a\${b}c' +");
8080 JUnitTestCase.assertNotNull(following); 8078 expect(following, isNotNull);
8081 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8079 expect(following.type, TokenType.PLUS);
8082 } 8080 }
8083 8081
8084 void test_skipStringLiteral_invalid() { 8082 void test_skipStringLiteral_invalid() {
8085 Token following = _skip("skipStringLiteral", "a"); 8083 Token following = _skip("skipStringLiteral", "a");
8086 JUnitTestCase.assertNull(following); 8084 expect(following, isNull);
8087 } 8085 }
8088 8086
8089 void test_skipStringLiteral_single() { 8087 void test_skipStringLiteral_single() {
8090 Token following = _skip("skipStringLiteral", "'a' +"); 8088 Token following = _skip("skipStringLiteral", "'a' +");
8091 JUnitTestCase.assertNotNull(following); 8089 expect(following, isNotNull);
8092 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8090 expect(following.type, TokenType.PLUS);
8093 } 8091 }
8094 8092
8095 void test_skipTypeArgumentList_invalid() { 8093 void test_skipTypeArgumentList_invalid() {
8096 Token following = _skip("skipTypeArgumentList", "+"); 8094 Token following = _skip("skipTypeArgumentList", "+");
8097 JUnitTestCase.assertNull(following); 8095 expect(following, isNull);
8098 } 8096 }
8099 8097
8100 void test_skipTypeArgumentList_multiple() { 8098 void test_skipTypeArgumentList_multiple() {
8101 Token following = _skip("skipTypeArgumentList", "<E, F, G> +"); 8099 Token following = _skip("skipTypeArgumentList", "<E, F, G> +");
8102 JUnitTestCase.assertNotNull(following); 8100 expect(following, isNotNull);
8103 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8101 expect(following.type, TokenType.PLUS);
8104 } 8102 }
8105 8103
8106 void test_skipTypeArgumentList_single() { 8104 void test_skipTypeArgumentList_single() {
8107 Token following = _skip("skipTypeArgumentList", "<E> +"); 8105 Token following = _skip("skipTypeArgumentList", "<E> +");
8108 JUnitTestCase.assertNotNull(following); 8106 expect(following, isNotNull);
8109 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8107 expect(following.type, TokenType.PLUS);
8110 } 8108 }
8111 8109
8112 void test_skipTypeName_invalid() { 8110 void test_skipTypeName_invalid() {
8113 Token following = _skip("skipTypeName", "+"); 8111 Token following = _skip("skipTypeName", "+");
8114 JUnitTestCase.assertNull(following); 8112 expect(following, isNull);
8115 } 8113 }
8116 8114
8117 void test_skipTypeName_parameterized() { 8115 void test_skipTypeName_parameterized() {
8118 Token following = _skip("skipTypeName", "C<E<F<G>>> +"); 8116 Token following = _skip("skipTypeName", "C<E<F<G>>> +");
8119 JUnitTestCase.assertNotNull(following); 8117 expect(following, isNotNull);
8120 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8118 expect(following.type, TokenType.PLUS);
8121 } 8119 }
8122 8120
8123 void test_skipTypeName_simple() { 8121 void test_skipTypeName_simple() {
8124 Token following = _skip("skipTypeName", "C +"); 8122 Token following = _skip("skipTypeName", "C +");
8125 JUnitTestCase.assertNotNull(following); 8123 expect(following, isNotNull);
8126 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 8124 expect(following.type, TokenType.PLUS);
8127 } 8125 }
8128 8126
8129 /** 8127 /**
8130 * Invoke the method [Parser#computeStringValue] with the given argument. 8128 * Invoke the method [Parser#computeStringValue] with the given argument.
8131 * 8129 *
8132 * @param lexeme the argument to the method 8130 * @param lexeme the argument to the method
8133 * @param first `true` if this is the first token in a string literal 8131 * @param first `true` if this is the first token in a string literal
8134 * @param last `true` if this is the last token in a string literal 8132 * @param last `true` if this is the last token in a string literal
8135 * @return the result of invoking the method 8133 * @return the result of invoking the method
8136 * @throws Exception if the method could not be invoked or throws an exception 8134 * @throws Exception if the method could not be invoked or throws an exception
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
8237 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 8235 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
8238 * 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`
8239 */ 8237 */
8240 CompilationUnit _parseDirectives(String source, List<ErrorCode> errorCodes) { 8238 CompilationUnit _parseDirectives(String source, List<ErrorCode> errorCodes) {
8241 GatheringErrorListener listener = new GatheringErrorListener(); 8239 GatheringErrorListener listener = new GatheringErrorListener();
8242 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener ); 8240 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener );
8243 listener.setLineInfo(new TestSource(), scanner.lineStarts); 8241 listener.setLineInfo(new TestSource(), scanner.lineStarts);
8244 Token token = scanner.tokenize(); 8242 Token token = scanner.tokenize();
8245 Parser parser = new Parser(null, listener); 8243 Parser parser = new Parser(null, listener);
8246 CompilationUnit unit = parser.parseDirectives(token); 8244 CompilationUnit unit = parser.parseDirectives(token);
8247 JUnitTestCase.assertNotNull(unit); 8245 expect(unit, isNotNull);
8248 EngineTestCase.assertSizeOfList(0, unit.declarations); 8246 EngineTestCase.assertSizeOfList(0, unit.declarations);
8249 listener.assertErrorsWithCodes(errorCodes); 8247 listener.assertErrorsWithCodes(errorCodes);
8250 return unit; 8248 return unit;
8251 } 8249 }
8252 8250
8253 /** 8251 /**
8254 * 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
8255 * parameter and is given the first token in the scanned source. 8253 * parameter and is given the first token in the scanned source.
8256 * 8254 *
8257 * @param methodName the name of the method that should be invoked 8255 * @param methodName the name of the method that should be invoked
(...skipping 11 matching lines...) Expand all
8269 Token tokenStream = scanner.tokenize(); 8267 Token tokenStream = scanner.tokenize();
8270 // 8268 //
8271 // Parse the source. 8269 // Parse the source.
8272 // 8270 //
8273 Parser parser = new Parser(null, listener); 8271 Parser parser = new Parser(null, listener);
8274 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to kenStream) as Token; 8272 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to kenStream) as Token;
8275 } 8273 }
8276 } 8274 }
8277 8275
8278 main() { 8276 main() {
8279 _ut.groupSep = ' | '; 8277 groupSep = ' | ';
8280 runReflectiveTests(ComplexParserTest); 8278 runReflectiveTests(ComplexParserTest);
8281 runReflectiveTests(ErrorParserTest); 8279 runReflectiveTests(ErrorParserTest);
8282 runReflectiveTests(IncrementalParserTest); 8280 runReflectiveTests(IncrementalParserTest);
8283 runReflectiveTests(NonErrorParserTest); 8281 runReflectiveTests(NonErrorParserTest);
8284 runReflectiveTests(RecoveryParserTest); 8282 runReflectiveTests(RecoveryParserTest);
8285 runReflectiveTests(ResolutionCopierTest); 8283 runReflectiveTests(ResolutionCopierTest);
8286 runReflectiveTests(SimpleParserTest); 8284 runReflectiveTests(SimpleParserTest);
8287 } 8285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698