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 library engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 int length = incrErrors.length; | 57 int length = incrErrors.length; |
58 for (int i = 0; i < length; i++) { | 58 for (int i = 0; i < length; i++) { |
59 AnalysisError incrError = incrErrors[i]; | 59 AnalysisError incrError = incrErrors[i]; |
60 AnalysisError fullError = fullErrors[i]; | 60 AnalysisError fullError = fullErrors[i]; |
61 _assertEqualError(incrError, fullError); | 61 _assertEqualError(incrError, fullError); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 @ReflectiveTestCase() | 66 @reflectiveTest |
67 class DeclarationMatcherTest extends ResolverTestCase { | 67 class DeclarationMatcherTest extends ResolverTestCase { |
68 void setUp() { | 68 void setUp() { |
69 super.setUp(); | 69 super.setUp(); |
70 test_resolveApiChanges = true; | 70 test_resolveApiChanges = true; |
71 } | 71 } |
72 | 72 |
73 void test_false_class_annotation_edit() { | 73 void test_false_class_annotation_edit() { |
74 _assertDoesNotMatch(r''' | 74 _assertDoesNotMatch(r''' |
75 const my_annotationA = const Object(); | 75 const my_annotationA = const Object(); |
76 const my_annotationB = const Object(); | 76 const my_annotationB = const Object(); |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 newUnit.accept(builder); | 2025 newUnit.accept(builder); |
2026 } | 2026 } |
2027 // match | 2027 // match |
2028 DeclarationMatcher matcher = new DeclarationMatcher(); | 2028 DeclarationMatcher matcher = new DeclarationMatcher(); |
2029 DeclarationMatchKind matchKind = matcher.matches(newUnit, oldUnit.element); | 2029 DeclarationMatchKind matchKind = matcher.matches(newUnit, oldUnit.element); |
2030 expect(matchKind, same(expectMatch)); | 2030 expect(matchKind, same(expectMatch)); |
2031 } | 2031 } |
2032 } | 2032 } |
2033 | 2033 |
2034 | 2034 |
2035 @ReflectiveTestCase() | 2035 @reflectiveTest |
2036 class IncrementalResolverTest extends ResolverTestCase { | 2036 class IncrementalResolverTest extends ResolverTestCase { |
2037 Source source; | 2037 Source source; |
2038 String code; | 2038 String code; |
2039 LibraryElement library; | 2039 LibraryElement library; |
2040 CompilationUnit unit; | 2040 CompilationUnit unit; |
2041 | 2041 |
2042 void setUp() { | 2042 void setUp() { |
2043 super.setUp(); | 2043 super.setUp(); |
2044 test_resolveApiChanges = true; | 2044 test_resolveApiChanges = true; |
2045 log.logger = log.NULL_LOGGER; | 2045 log.logger = log.NULL_LOGGER; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 token = token.next; | 2468 token = token.next; |
2469 } | 2469 } |
2470 } | 2470 } |
2471 } | 2471 } |
2472 | 2472 |
2473 | 2473 |
2474 /** | 2474 /** |
2475 * The test for [poorMansIncrementalResolution] function and its integration | 2475 * The test for [poorMansIncrementalResolution] function and its integration |
2476 * into [AnalysisContext]. | 2476 * into [AnalysisContext]. |
2477 */ | 2477 */ |
2478 @ReflectiveTestCase() | 2478 @reflectiveTest |
2479 class PoorMansIncrementalResolutionTest extends ResolverTestCase { | 2479 class PoorMansIncrementalResolutionTest extends ResolverTestCase { |
2480 Source source; | 2480 Source source; |
2481 String code; | 2481 String code; |
2482 LibraryElement oldLibrary; | 2482 LibraryElement oldLibrary; |
2483 CompilationUnit oldUnit; | 2483 CompilationUnit oldUnit; |
2484 CompilationUnitElement oldUnitElement; | 2484 CompilationUnitElement oldUnitElement; |
2485 | 2485 |
2486 void fail_updateErrors_removeExisting_duplicateMethodDeclaration() { | 2486 void fail_updateErrors_removeExisting_duplicateMethodDeclaration() { |
2487 // TODO(scheglov) We fail to remove the second "foo" declaration. | 2487 // TODO(scheglov) We fail to remove the second "foo" declaration. |
2488 // So, we still have the same duplicate declaration problem. | 2488 // So, we still have the same duplicate declaration problem. |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 } | 3276 } |
3277 } | 3277 } |
3278 // next tokens | 3278 // next tokens |
3279 incrToken = incrToken.next; | 3279 incrToken = incrToken.next; |
3280 fullToken = fullToken.next; | 3280 fullToken = fullToken.next; |
3281 } | 3281 } |
3282 } | 3282 } |
3283 } | 3283 } |
3284 | 3284 |
3285 | 3285 |
3286 @ReflectiveTestCase() | 3286 @reflectiveTest |
3287 class ResolutionContextBuilderTest extends EngineTestCase { | 3287 class ResolutionContextBuilderTest extends EngineTestCase { |
3288 GatheringErrorListener listener = new GatheringErrorListener(); | 3288 GatheringErrorListener listener = new GatheringErrorListener(); |
3289 | 3289 |
3290 void test_scopeFor_ClassDeclaration() { | 3290 void test_scopeFor_ClassDeclaration() { |
3291 Scope scope = _scopeFor(_createResolvedClassDeclaration()); | 3291 Scope scope = _scopeFor(_createResolvedClassDeclaration()); |
3292 EngineTestCase.assertInstanceOf( | 3292 EngineTestCase.assertInstanceOf( |
3293 (obj) => obj is LibraryScope, | 3293 (obj) => obj is LibraryScope, |
3294 LibraryScope, | 3294 LibraryScope, |
3295 scope); | 3295 scope); |
3296 } | 3296 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3522 } | 3522 } |
3523 } | 3523 } |
3524 | 3524 |
3525 | 3525 |
3526 class _Edit { | 3526 class _Edit { |
3527 final int offset; | 3527 final int offset; |
3528 final int length; | 3528 final int length; |
3529 final String replacement; | 3529 final String replacement; |
3530 _Edit(this.offset, this.length, this.replacement); | 3530 _Edit(this.offset, this.length, this.replacement); |
3531 } | 3531 } |
OLD | NEW |