| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 main() { | 28 main() { |
| 29 groupSep = ' | '; | 29 groupSep = ' | '; |
| 30 runReflectiveTests(DeclarationMatcherTest); | 30 runReflectiveTests(DeclarationMatcherTest); |
| 31 runReflectiveTests(IncrementalResolverTest); | 31 runReflectiveTests(IncrementalResolverTest); |
| 32 runReflectiveTests(PoorMansIncrementalResolutionTest); | 32 runReflectiveTests(PoorMansIncrementalResolutionTest); |
| 33 runReflectiveTests(ResolutionContextBuilderTest); | 33 runReflectiveTests(ResolutionContextBuilderTest); |
| 34 } | 34 } |
| 35 | 35 |
| 36 | 36 |
| 37 @ReflectiveTestCase() |
| 37 class DeclarationMatcherTest extends ResolverTestCase { | 38 class DeclarationMatcherTest extends ResolverTestCase { |
| 38 void setUp() { | 39 void setUp() { |
| 39 super.setUp(); | 40 super.setUp(); |
| 40 test_resolveApiChanges = true; | 41 test_resolveApiChanges = true; |
| 41 } | 42 } |
| 42 | 43 |
| 43 void test_false_class_list_add() { | 44 void test_false_class_list_add() { |
| 44 _assertDoesNotMatch(r''' | 45 _assertDoesNotMatch(r''' |
| 45 class A {} | 46 class A {} |
| 46 class B {} | 47 class B {} |
| (...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 newUnit.accept(builder); | 1882 newUnit.accept(builder); |
| 1882 } | 1883 } |
| 1883 // match | 1884 // match |
| 1884 DeclarationMatcher matcher = new DeclarationMatcher(); | 1885 DeclarationMatcher matcher = new DeclarationMatcher(); |
| 1885 DeclarationMatchKind matchKind = matcher.matches(newUnit, oldUnit.element); | 1886 DeclarationMatchKind matchKind = matcher.matches(newUnit, oldUnit.element); |
| 1886 expect(matchKind, same(expectMatch)); | 1887 expect(matchKind, same(expectMatch)); |
| 1887 } | 1888 } |
| 1888 } | 1889 } |
| 1889 | 1890 |
| 1890 | 1891 |
| 1892 @ReflectiveTestCase() |
| 1891 class IncrementalResolverTest extends ResolverTestCase { | 1893 class IncrementalResolverTest extends ResolverTestCase { |
| 1892 Source source; | 1894 Source source; |
| 1893 String code; | 1895 String code; |
| 1894 LibraryElement library; | 1896 LibraryElement library; |
| 1895 CompilationUnit unit; | 1897 CompilationUnit unit; |
| 1896 | 1898 |
| 1897 void setUp() { | 1899 void setUp() { |
| 1898 super.setUp(); | 1900 super.setUp(); |
| 1899 test_resolveApiChanges = true; | 1901 test_resolveApiChanges = true; |
| 1900 } | 1902 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 token = token.next; | 2284 token = token.next; |
| 2283 } | 2285 } |
| 2284 } | 2286 } |
| 2285 } | 2287 } |
| 2286 | 2288 |
| 2287 | 2289 |
| 2288 /** | 2290 /** |
| 2289 * The test for [poorMansIncrementalResolution] function and its integration | 2291 * The test for [poorMansIncrementalResolution] function and its integration |
| 2290 * into [AnalysisContext]. | 2292 * into [AnalysisContext]. |
| 2291 */ | 2293 */ |
| 2294 @ReflectiveTestCase() |
| 2292 class PoorMansIncrementalResolutionTest extends ResolverTestCase { | 2295 class PoorMansIncrementalResolutionTest extends ResolverTestCase { |
| 2293 Source source; | 2296 Source source; |
| 2294 String code; | 2297 String code; |
| 2295 LibraryElement oldLibrary; | 2298 LibraryElement oldLibrary; |
| 2296 CompilationUnit oldUnit; | 2299 CompilationUnit oldUnit; |
| 2297 CompilationUnitElement oldUnitElement; | 2300 CompilationUnitElement oldUnitElement; |
| 2298 | 2301 |
| 2299 void setUp() { | 2302 void setUp() { |
| 2300 super.setUp(); | 2303 super.setUp(); |
| 2301 _resetWithIncremental(true); | 2304 _resetWithIncremental(true); |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3026 } | 3029 } |
| 3027 } | 3030 } |
| 3028 // next tokens | 3031 // next tokens |
| 3029 incrToken = incrToken.next; | 3032 incrToken = incrToken.next; |
| 3030 fullToken = fullToken.next; | 3033 fullToken = fullToken.next; |
| 3031 } | 3034 } |
| 3032 } | 3035 } |
| 3033 } | 3036 } |
| 3034 | 3037 |
| 3035 | 3038 |
| 3039 @ReflectiveTestCase() |
| 3036 class ResolutionContextBuilderTest extends EngineTestCase { | 3040 class ResolutionContextBuilderTest extends EngineTestCase { |
| 3037 GatheringErrorListener listener = new GatheringErrorListener(); | 3041 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3038 | 3042 |
| 3039 void test_scopeFor_ClassDeclaration() { | 3043 void test_scopeFor_ClassDeclaration() { |
| 3040 Scope scope = _scopeFor(_createResolvedClassDeclaration()); | 3044 Scope scope = _scopeFor(_createResolvedClassDeclaration()); |
| 3041 EngineTestCase.assertInstanceOf( | 3045 EngineTestCase.assertInstanceOf( |
| 3042 (obj) => obj is LibraryScope, | 3046 (obj) => obj is LibraryScope, |
| 3043 LibraryScope, | 3047 LibraryScope, |
| 3044 scope); | 3048 scope); |
| 3045 } | 3049 } |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4096 _visitList(node.metadata, other.metadata); | 4100 _visitList(node.metadata, other.metadata); |
| 4097 _visitNode(node.identifier, other.identifier); | 4101 _visitNode(node.identifier, other.identifier); |
| 4098 } | 4102 } |
| 4099 | 4103 |
| 4100 static void assertSameResolution(CompilationUnit actual, | 4104 static void assertSameResolution(CompilationUnit actual, |
| 4101 CompilationUnit expected) { | 4105 CompilationUnit expected) { |
| 4102 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 4106 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 4103 actual.accept(validator); | 4107 actual.accept(validator); |
| 4104 } | 4108 } |
| 4105 } | 4109 } |
| OLD | NEW |