| OLD | NEW |
| 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'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3033 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS
tart, removed.length, added.length); | 3033 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS
tart, removed.length, added.length); |
| 3034 JUnitTestCase.assertNotNull(incrementalTokens); | 3034 JUnitTestCase.assertNotNull(incrementalTokens); |
| 3035 IncrementalParser incrementalParser = new IncrementalParser(source, incremen
talScanner.tokenMap, incrementalListener); | 3035 IncrementalParser incrementalParser = new IncrementalParser(source, incremen
talScanner.tokenMap, incrementalListener); |
| 3036 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in
crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix.
length + removed.length); | 3036 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in
crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix.
length + removed.length); |
| 3037 JUnitTestCase.assertNotNull(incrementalUnit); | 3037 JUnitTestCase.assertNotNull(incrementalUnit); |
| 3038 // | 3038 // |
| 3039 // Validate that the results of the incremental parse are the same as the fu
ll parse of the | 3039 // Validate that the results of the incremental parse are the same as the fu
ll parse of the |
| 3040 // modified source. | 3040 // modified source. |
| 3041 // | 3041 // |
| 3042 JUnitTestCase.assertTrue(AstComparator.equalNodes(modifiedUnit, incrementalU
nit)); | 3042 JUnitTestCase.assertTrue(AstComparator.equalNodes(modifiedUnit, incrementalU
nit)); |
| 3043 // TODO(brianwilkerson) Verify that the errors are correct? |
| 3043 } | 3044 } |
| 3044 | 3045 |
| 3045 static dartSuite() { | 3046 static dartSuite() { |
| 3046 _ut.group('IncrementalParserTest', () { | 3047 _ut.group('IncrementalParserTest', () { |
| 3047 _ut.test('test_delete_everything', () { | 3048 _ut.test('test_delete_everything', () { |
| 3048 final __test = new IncrementalParserTest(); | 3049 final __test = new IncrementalParserTest(); |
| 3049 runJUnitTest(__test, __test.test_delete_everything); | 3050 runJUnitTest(__test, __test.test_delete_everything); |
| 3050 }); | 3051 }); |
| 3051 _ut.test('test_delete_identifier_beginning', () { | 3052 _ut.test('test_delete_identifier_beginning', () { |
| 3052 final __test = new IncrementalParserTest(); | 3053 final __test = new IncrementalParserTest(); |
| (...skipping 4055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7108 | 7109 |
| 7109 void test_parseConstExpression_mapLiteral_untyped() { | 7110 void test_parseConstExpression_mapLiteral_untyped() { |
| 7110 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {}
", []); | 7111 MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {}
", []); |
| 7111 JUnitTestCase.assertNotNull(literal.leftBracket); | 7112 JUnitTestCase.assertNotNull(literal.leftBracket); |
| 7112 EngineTestCase.assertSizeOfList(0, literal.entries); | 7113 EngineTestCase.assertSizeOfList(0, literal.entries); |
| 7113 JUnitTestCase.assertNotNull(literal.rightBracket); | 7114 JUnitTestCase.assertNotNull(literal.rightBracket); |
| 7114 JUnitTestCase.assertNull(literal.typeArguments); | 7115 JUnitTestCase.assertNull(literal.typeArguments); |
| 7115 } | 7116 } |
| 7116 | 7117 |
| 7117 void test_parseConstructor() { | 7118 void test_parseConstructor() { |
| 7119 // TODO(brianwilkerson) Implement tests for this method. |
| 7120 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class
, |
| 7121 // Token.class, Token.class, SimpleIdentifier.class, Token.class, |
| 7122 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] {
emptyCommentAndMetadata(), |
| 7123 // null, null, null, null, null, null}, ""); |
| 7118 } | 7124 } |
| 7119 | 7125 |
| 7120 void test_parseConstructor_with_pseudo_function_literal() { | 7126 void test_parseConstructor_with_pseudo_function_literal() { |
| 7121 // "(b) {}" should not be misinterpreted as a function literal even though i
t looks like one. | 7127 // "(b) {}" should not be misinterpreted as a function literal even though i
t looks like one. |
| 7122 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object>
["C"], "C() : a = (b) {}"); | 7128 ClassMember classMember = ParserTestCase.parse("parseClassMember", <Object>
["C"], "C() : a = (b) {}"); |
| 7123 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons
tructorDeclaration, classMember); | 7129 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, Cons
tructorDeclaration, classMember); |
| 7124 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; | 7130 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; |
| 7125 NodeList<ConstructorInitializer> initializers = constructor.initializers; | 7131 NodeList<ConstructorInitializer> initializers = constructor.initializers; |
| 7126 EngineTestCase.assertSizeOfList(1, initializers); | 7132 EngineTestCase.assertSizeOfList(1, initializers); |
| 7127 ConstructorInitializer initializer = initializers[0]; | 7133 ConstructorInitializer initializer = initializers[0]; |
| (...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8872 JUnitTestCase.assertNull(method.externalKeyword); | 8878 JUnitTestCase.assertNull(method.externalKeyword); |
| 8873 JUnitTestCase.assertNull(method.modifierKeyword); | 8879 JUnitTestCase.assertNull(method.modifierKeyword); |
| 8874 JUnitTestCase.assertNotNull(method.name); | 8880 JUnitTestCase.assertNotNull(method.name); |
| 8875 JUnitTestCase.assertNotNull(method.operatorKeyword); | 8881 JUnitTestCase.assertNotNull(method.operatorKeyword); |
| 8876 JUnitTestCase.assertNotNull(method.parameters); | 8882 JUnitTestCase.assertNotNull(method.parameters); |
| 8877 JUnitTestCase.assertNull(method.propertyKeyword); | 8883 JUnitTestCase.assertNull(method.propertyKeyword); |
| 8878 JUnitTestCase.assertEquals(returnType, method.returnType); | 8884 JUnitTestCase.assertEquals(returnType, method.returnType); |
| 8879 } | 8885 } |
| 8880 | 8886 |
| 8881 void test_parseOptionalReturnType() { | 8887 void test_parseOptionalReturnType() { |
| 8888 // TODO(brianwilkerson) Implement tests for this method. |
| 8882 } | 8889 } |
| 8883 | 8890 |
| 8884 void test_parsePartDirective_part() { | 8891 void test_parsePartDirective_part() { |
| 8885 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object
> [emptyCommentAndMetadata()], "part 'lib/lib.dart';"); | 8892 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object
> [emptyCommentAndMetadata()], "part 'lib/lib.dart';"); |
| 8886 JUnitTestCase.assertNotNull(directive.partToken); | 8893 JUnitTestCase.assertNotNull(directive.partToken); |
| 8887 JUnitTestCase.assertNotNull(directive.uri); | 8894 JUnitTestCase.assertNotNull(directive.uri); |
| 8888 JUnitTestCase.assertNotNull(directive.semicolon); | 8895 JUnitTestCase.assertNotNull(directive.semicolon); |
| 8889 } | 8896 } |
| 8890 | 8897 |
| 8891 void test_parsePartDirective_partOf() { | 8898 void test_parsePartDirective_partOf() { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9224 } | 9231 } |
| 9225 | 9232 |
| 9226 void test_parseSimpleIdentifier_normalIdentifier() { | 9233 void test_parseSimpleIdentifier_normalIdentifier() { |
| 9227 String lexeme = "foo"; | 9234 String lexeme = "foo"; |
| 9228 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier",
lexeme, []); | 9235 SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier",
lexeme, []); |
| 9229 JUnitTestCase.assertNotNull(identifier.token); | 9236 JUnitTestCase.assertNotNull(identifier.token); |
| 9230 JUnitTestCase.assertEquals(lexeme, identifier.name); | 9237 JUnitTestCase.assertEquals(lexeme, identifier.name); |
| 9231 } | 9238 } |
| 9232 | 9239 |
| 9233 void test_parseSimpleIdentifier1_normalIdentifier() { | 9240 void test_parseSimpleIdentifier1_normalIdentifier() { |
| 9241 // TODO(brianwilkerson) Implement tests for this method. |
| 9234 } | 9242 } |
| 9235 | 9243 |
| 9236 void test_parseStatement_functionDeclaration() { | 9244 void test_parseStatement_functionDeclaration() { |
| 9237 // TODO(brianwilkerson) Implement more tests for this method. | 9245 // TODO(brianwilkerson) Implement more tests for this method. |
| 9238 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme
nt", "int f(a, b) {};", []); | 9246 FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStateme
nt", "int f(a, b) {};", []); |
| 9239 JUnitTestCase.assertNotNull(statement.functionDeclaration); | 9247 JUnitTestCase.assertNotNull(statement.functionDeclaration); |
| 9240 } | 9248 } |
| 9241 | 9249 |
| 9242 void test_parseStatement_mulipleLabels() { | 9250 void test_parseStatement_mulipleLabels() { |
| 9243 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m:
return x;", []); | 9251 LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: m:
return x;", []); |
| (...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12476 | 12484 |
| 12477 main() { | 12485 main() { |
| 12478 ComplexParserTest.dartSuite(); | 12486 ComplexParserTest.dartSuite(); |
| 12479 ErrorParserTest.dartSuite(); | 12487 ErrorParserTest.dartSuite(); |
| 12480 IncrementalParserTest.dartSuite(); | 12488 IncrementalParserTest.dartSuite(); |
| 12481 NonErrorParserTest.dartSuite(); | 12489 NonErrorParserTest.dartSuite(); |
| 12482 RecoveryParserTest.dartSuite(); | 12490 RecoveryParserTest.dartSuite(); |
| 12483 ResolutionCopierTest.dartSuite(); | 12491 ResolutionCopierTest.dartSuite(); |
| 12484 SimpleParserTest.dartSuite(); | 12492 SimpleParserTest.dartSuite(); |
| 12485 } | 12493 } |
| OLD | NEW |