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

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

Issue 103233003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.resolver_test; 4 library engine.resolver_test;
5 5
6 import 'package:analyzer/src/generated/java_core.dart'; 6 import 'package:analyzer/src/generated/java_core.dart';
7 import 'package:analyzer/src/generated/java_junit.dart'; 7 import 'package:analyzer/src/generated/java_junit.dart';
8 import 'package:analyzer/src/generated/source_io.dart'; 8 import 'package:analyzer/src/generated/source_io.dart';
9 import 'package:analyzer/src/generated/error.dart'; 9 import 'package:analyzer/src/generated/error.dart';
10 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 verify([source]); 1483 verify([source]);
1484 } 1484 }
1485 1485
1486 void test_defaultValueInFunctionTypedParameter_optional() { 1486 void test_defaultValueInFunctionTypedParameter_optional() {
1487 Source source = addSource(EngineTestCase.createSource(["f(g([p])) {}"])); 1487 Source source = addSource(EngineTestCase.createSource(["f(g([p])) {}"]));
1488 resolve(source); 1488 resolve(source);
1489 assertNoErrors(source); 1489 assertNoErrors(source);
1490 verify([source]); 1490 verify([source]);
1491 } 1491 }
1492 1492
1493 void test_deprecatedMemberUse_hide() {
1494 Source source = addSource(EngineTestCase.createSource([
1495 "library lib;",
1496 "import 'lib1.dart' hide B;",
1497 "A a = new A();"]));
1498 addSource2("/lib1.dart", EngineTestCase.createSource([
1499 "library lib1;",
1500 "class A {}",
1501 "@deprecated",
1502 "class B {}"]));
1503 resolve(source);
1504 assertNoErrors(source);
1505 verify([source]);
1506 }
1507
1493 void test_duplicateDefinition_emptyName() { 1508 void test_duplicateDefinition_emptyName() {
1494 Source source = addSource(EngineTestCase.createSource([ 1509 Source source = addSource(EngineTestCase.createSource([
1495 "Map _globalMap = {", 1510 "Map _globalMap = {",
1496 " 'a' : () {},", 1511 " 'a' : () {},",
1497 " 'b' : () {}", 1512 " 'b' : () {}",
1498 "};"])); 1513 "};"]));
1499 resolve(source); 1514 resolve(source);
1500 assertNoErrors(source); 1515 assertNoErrors(source);
1501 verify([source]); 1516 verify([source]);
1502 } 1517 }
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 } 4139 }
4125 4140
4126 void test_undefinedIdentifier_show() { 4141 void test_undefinedIdentifier_show() {
4127 Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart' show a;"])); 4142 Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart' show a;"]));
4128 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); 4143 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"]));
4129 resolve(source); 4144 resolve(source);
4130 assertNoErrors(source); 4145 assertNoErrors(source);
4131 verify([source]); 4146 verify([source]);
4132 } 4147 }
4133 4148
4149 void test_undefinedIdentifier_synthetic_whenExpression() {
4150 Source source = addSource(EngineTestCase.createSource(["print(x) {}", "main( ) {", " print(is String);", "}"]));
4151 resolve(source);
4152 assertErrors(source, [ParserErrorCode.MISSING_IDENTIFIER]);
4153 }
4154
4155 void test_undefinedIdentifier_synthetic_whenMethodName() {
4156 Source source = addSource(EngineTestCase.createSource(["print(x) {}", "main( int p) {", " p.();", "}"]));
4157 resolve(source);
4158 assertErrors(source, [ParserErrorCode.MISSING_IDENTIFIER]);
4159 }
4160
4134 void test_undefinedMethod_functionExpression_callMethod() { 4161 void test_undefinedMethod_functionExpression_callMethod() {
4135 Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null).call();", "}"])); 4162 Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null).call();", "}"]));
4136 resolve(source); 4163 resolve(source);
4137 assertNoErrors(source); 4164 assertNoErrors(source);
4138 } 4165 }
4139 4166
4140 void test_undefinedMethod_functionExpression_directCall() { 4167 void test_undefinedMethod_functionExpression_directCall() {
4141 Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null)();", "}"])); 4168 Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null)();", "}"]));
4142 resolve(source); 4169 resolve(source);
4143 assertNoErrors(source); 4170 assertNoErrors(source);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
4453 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); 4480 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
4454 }); 4481 });
4455 _ut.test('test_defaultValueInFunctionTypedParameter_named', () { 4482 _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
4456 final __test = new NonErrorResolverTest(); 4483 final __test = new NonErrorResolverTest();
4457 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na med); 4484 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na med);
4458 }); 4485 });
4459 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () { 4486 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
4460 final __test = new NonErrorResolverTest(); 4487 final __test = new NonErrorResolverTest();
4461 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_op tional); 4488 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_op tional);
4462 }); 4489 });
4490 _ut.test('test_deprecatedMemberUse_hide', () {
4491 final __test = new NonErrorResolverTest();
4492 runJUnitTest(__test, __test.test_deprecatedMemberUse_hide);
4493 });
4463 _ut.test('test_duplicateDefinition_emptyName', () { 4494 _ut.test('test_duplicateDefinition_emptyName', () {
4464 final __test = new NonErrorResolverTest(); 4495 final __test = new NonErrorResolverTest();
4465 runJUnitTest(__test, __test.test_duplicateDefinition_emptyName); 4496 runJUnitTest(__test, __test.test_duplicateDefinition_emptyName);
4466 }); 4497 });
4467 _ut.test('test_duplicateDefinition_getter', () { 4498 _ut.test('test_duplicateDefinition_getter', () {
4468 final __test = new NonErrorResolverTest(); 4499 final __test = new NonErrorResolverTest();
4469 runJUnitTest(__test, __test.test_duplicateDefinition_getter); 4500 runJUnitTest(__test, __test.test_duplicateDefinition_getter);
4470 }); 4501 });
4471 _ut.test('test_dynamicIdentifier', () { 4502 _ut.test('test_dynamicIdentifier', () {
4472 final __test = new NonErrorResolverTest(); 4503 final __test = new NonErrorResolverTest();
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
5381 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); 5412 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution);
5382 }); 5413 });
5383 _ut.test('test_undefinedIdentifier_hide', () { 5414 _ut.test('test_undefinedIdentifier_hide', () {
5384 final __test = new NonErrorResolverTest(); 5415 final __test = new NonErrorResolverTest();
5385 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); 5416 runJUnitTest(__test, __test.test_undefinedIdentifier_hide);
5386 }); 5417 });
5387 _ut.test('test_undefinedIdentifier_show', () { 5418 _ut.test('test_undefinedIdentifier_show', () {
5388 final __test = new NonErrorResolverTest(); 5419 final __test = new NonErrorResolverTest();
5389 runJUnitTest(__test, __test.test_undefinedIdentifier_show); 5420 runJUnitTest(__test, __test.test_undefinedIdentifier_show);
5390 }); 5421 });
5422 _ut.test('test_undefinedIdentifier_synthetic_whenExpression', () {
5423 final __test = new NonErrorResolverTest();
5424 runJUnitTest(__test, __test.test_undefinedIdentifier_synthetic_whenExpre ssion);
5425 });
5426 _ut.test('test_undefinedIdentifier_synthetic_whenMethodName', () {
5427 final __test = new NonErrorResolverTest();
5428 runJUnitTest(__test, __test.test_undefinedIdentifier_synthetic_whenMetho dName);
5429 });
5391 _ut.test('test_undefinedMethod_functionExpression_callMethod', () { 5430 _ut.test('test_undefinedMethod_functionExpression_callMethod', () {
5392 final __test = new NonErrorResolverTest(); 5431 final __test = new NonErrorResolverTest();
5393 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_call Method); 5432 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_call Method);
5394 }); 5433 });
5395 _ut.test('test_undefinedMethod_functionExpression_directCall', () { 5434 _ut.test('test_undefinedMethod_functionExpression_directCall', () {
5396 final __test = new NonErrorResolverTest(); 5435 final __test = new NonErrorResolverTest();
5397 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_dire ctCall); 5436 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_dire ctCall);
5398 }); 5437 });
5399 _ut.test('test_undefinedOperator_index', () { 5438 _ut.test('test_undefinedOperator_index', () {
5400 final __test = new NonErrorResolverTest(); 5439 final __test = new NonErrorResolverTest();
(...skipping 7046 matching lines...) Expand 10 before | Expand all | Expand 10 after
12447 "class A {}", 12486 "class A {}",
12448 "class B {", 12487 "class B {",
12449 " B() : super(), this.name();", 12488 " B() : super(), this.name();",
12450 " B.name() {}", 12489 " B.name() {}",
12451 "}"])); 12490 "}"]));
12452 resolve(source); 12491 resolve(source);
12453 assertErrors(source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR] ); 12492 assertErrors(source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR] );
12454 verify([source]); 12493 verify([source]);
12455 } 12494 }
12456 12495
12496 void test_typeAliasCannotReferenceItself_11987() {
12497 Source source = addSource(EngineTestCase.createSource([
12498 "typedef void F(List<G> l);",
12499 "typedef void G(List<F> l);",
12500 "main() {",
12501 " F foo(G g) => g;",
12502 "}"]));
12503 resolve(source);
12504 assertErrors(source, [
12505 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
12506 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
12507 StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
12508 verify([source]);
12509 }
12510
12457 void test_typeAliasCannotReferenceItself_parameterType_named() { 12511 void test_typeAliasCannotReferenceItself_parameterType_named() {
12458 Source source = addSource(EngineTestCase.createSource(["typedef A({A a});"]) ); 12512 Source source = addSource(EngineTestCase.createSource(["typedef A({A a});"]) );
12459 resolve(source); 12513 resolve(source);
12460 assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSEL F]); 12514 assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSEL F]);
12461 verify([source]); 12515 verify([source]);
12462 } 12516 }
12463 12517
12464 void test_typeAliasCannotReferenceItself_parameterType_positional() { 12518 void test_typeAliasCannotReferenceItself_parameterType_positional() {
12465 Source source = addSource(EngineTestCase.createSource(["typedef A([A a]);"]) ); 12519 Source source = addSource(EngineTestCase.createSource(["typedef A([A a]);"]) );
12466 resolve(source); 12520 resolve(source);
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
13955 runJUnitTest(__test, __test.test_superInInvalidContext_topLevelVariableI nitializer); 14009 runJUnitTest(__test, __test.test_superInInvalidContext_topLevelVariableI nitializer);
13956 }); 14010 });
13957 _ut.test('test_superInRedirectingConstructor_redirectionSuper', () { 14011 _ut.test('test_superInRedirectingConstructor_redirectionSuper', () {
13958 final __test = new CompileTimeErrorCodeTest(); 14012 final __test = new CompileTimeErrorCodeTest();
13959 runJUnitTest(__test, __test.test_superInRedirectingConstructor_redirecti onSuper); 14013 runJUnitTest(__test, __test.test_superInRedirectingConstructor_redirecti onSuper);
13960 }); 14014 });
13961 _ut.test('test_superInRedirectingConstructor_superRedirection', () { 14015 _ut.test('test_superInRedirectingConstructor_superRedirection', () {
13962 final __test = new CompileTimeErrorCodeTest(); 14016 final __test = new CompileTimeErrorCodeTest();
13963 runJUnitTest(__test, __test.test_superInRedirectingConstructor_superRedi rection); 14017 runJUnitTest(__test, __test.test_superInRedirectingConstructor_superRedi rection);
13964 }); 14018 });
14019 _ut.test('test_typeAliasCannotReferenceItself_11987', () {
14020 final __test = new CompileTimeErrorCodeTest();
14021 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_11987);
14022 });
13965 _ut.test('test_typeAliasCannotReferenceItself_parameterType_named', () { 14023 _ut.test('test_typeAliasCannotReferenceItself_parameterType_named', () {
13966 final __test = new CompileTimeErrorCodeTest(); 14024 final __test = new CompileTimeErrorCodeTest();
13967 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete rType_named); 14025 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete rType_named);
13968 }); 14026 });
13969 _ut.test('test_typeAliasCannotReferenceItself_parameterType_positional', ( ) { 14027 _ut.test('test_typeAliasCannotReferenceItself_parameterType_positional', ( ) {
13970 final __test = new CompileTimeErrorCodeTest(); 14028 final __test = new CompileTimeErrorCodeTest();
13971 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete rType_positional); 14029 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete rType_positional);
13972 }); 14030 });
13973 _ut.test('test_typeAliasCannotReferenceItself_parameterType_required', () { 14031 _ut.test('test_typeAliasCannotReferenceItself_parameterType_required', () {
13974 final __test = new CompileTimeErrorCodeTest(); 14032 final __test = new CompileTimeErrorCodeTest();
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
14305 " sum += list[i];", 14363 " sum += list[i];",
14306 " }", 14364 " }",
14307 "}"])); 14365 "}"]));
14308 resolve(source); 14366 resolve(source);
14309 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); 14367 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
14310 } 14368 }
14311 14369
14312 void setUp() { 14370 void setUp() {
14313 super.setUp(); 14371 super.setUp();
14314 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 14372 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
14315 options.strictMode = true;
14316 options.hint = false; 14373 options.hint = false;
14317 analysisContext.analysisOptions = options; 14374 analysisContext.analysisOptions = options;
14318 } 14375 }
14319 14376
14320 void test_assert_is() { 14377 void test_assert_is() {
14321 Source source = addSource(EngineTestCase.createSource([ 14378 Source source = addSource(EngineTestCase.createSource([
14322 "int f(num n) {", 14379 "int f(num n) {",
14323 " assert (n is int);", 14380 " assert (n is int);",
14324 " return n & 0x0F;", 14381 " return n & 0x0F;",
14325 "}"])); 14382 "}"]));
(...skipping 6939 matching lines...) Expand 10 before | Expand all | Expand 10 after
21265 final __test = new NonHintCodeTest(); 21322 final __test = new NonHintCodeTest();
21266 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); 21323 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction);
21267 }); 21324 });
21268 }); 21325 });
21269 } 21326 }
21270 } 21327 }
21271 21328
21272 class EnclosedScopeTest extends ResolverTestCase { 21329 class EnclosedScopeTest extends ResolverTestCase {
21273 void test_define_duplicate() { 21330 void test_define_duplicate() {
21274 GatheringErrorListener errorListener2 = new GatheringErrorListener(); 21331 GatheringErrorListener errorListener2 = new GatheringErrorListener();
21275 Scope rootScope = new Scope_22(errorListener2); 21332 Scope rootScope = new Scope_23(errorListener2);
21276 EnclosedScope scope = new EnclosedScope(rootScope); 21333 EnclosedScope scope = new EnclosedScope(rootScope);
21277 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 21334 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
21278 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 21335 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
21279 scope.define(element1); 21336 scope.define(element1);
21280 scope.define(element2); 21337 scope.define(element2);
21281 errorListener2.assertErrors3([ErrorSeverity.ERROR]); 21338 errorListener2.assertErrors3([ErrorSeverity.ERROR]);
21282 } 21339 }
21283 21340
21284 void test_define_normal() { 21341 void test_define_normal() {
21285 GatheringErrorListener errorListener3 = new GatheringErrorListener(); 21342 GatheringErrorListener errorListener3 = new GatheringErrorListener();
21286 Scope rootScope = new Scope_23(errorListener3); 21343 Scope rootScope = new Scope_24(errorListener3);
21287 EnclosedScope outerScope = new EnclosedScope(rootScope); 21344 EnclosedScope outerScope = new EnclosedScope(rootScope);
21288 EnclosedScope innerScope = new EnclosedScope(outerScope); 21345 EnclosedScope innerScope = new EnclosedScope(outerScope);
21289 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 21346 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
21290 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2")); 21347 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2"));
21291 outerScope.define(element1); 21348 outerScope.define(element1);
21292 innerScope.define(element2); 21349 innerScope.define(element2);
21293 errorListener3.assertNoErrors(); 21350 errorListener3.assertNoErrors();
21294 } 21351 }
21295 21352
21296 static dartSuite() { 21353 static dartSuite() {
21297 _ut.group('EnclosedScopeTest', () { 21354 _ut.group('EnclosedScopeTest', () {
21298 _ut.test('test_define_duplicate', () { 21355 _ut.test('test_define_duplicate', () {
21299 final __test = new EnclosedScopeTest(); 21356 final __test = new EnclosedScopeTest();
21300 runJUnitTest(__test, __test.test_define_duplicate); 21357 runJUnitTest(__test, __test.test_define_duplicate);
21301 }); 21358 });
21302 _ut.test('test_define_normal', () { 21359 _ut.test('test_define_normal', () {
21303 final __test = new EnclosedScopeTest(); 21360 final __test = new EnclosedScopeTest();
21304 runJUnitTest(__test, __test.test_define_normal); 21361 runJUnitTest(__test, __test.test_define_normal);
21305 }); 21362 });
21306 }); 21363 });
21307 } 21364 }
21308 } 21365 }
21309 21366
21310 class Scope_22 extends Scope { 21367 class Scope_23 extends Scope {
21311 GatheringErrorListener errorListener2; 21368 GatheringErrorListener errorListener2;
21312 21369
21313 Scope_22(this.errorListener2) : super(); 21370 Scope_23(this.errorListener2) : super();
21314 21371
21315 AnalysisErrorListener get errorListener => errorListener2; 21372 AnalysisErrorListener get errorListener => errorListener2;
21316 21373
21317 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null; 21374 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null;
21318 } 21375 }
21319 21376
21320 class Scope_23 extends Scope { 21377 class Scope_24 extends Scope {
21321 GatheringErrorListener errorListener3; 21378 GatheringErrorListener errorListener3;
21322 21379
21323 Scope_23(this.errorListener3) : super(); 21380 Scope_24(this.errorListener3) : super();
21324 21381
21325 AnalysisErrorListener get errorListener => errorListener3; 21382 AnalysisErrorListener get errorListener => errorListener3;
21326 21383
21327 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null; 21384 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null;
21328 } 21385 }
21329 21386
21330 class LibraryElementBuilderTest extends EngineTestCase { 21387 class LibraryElementBuilderTest extends EngineTestCase {
21331 /** 21388 /**
21332 * The source factory used to create [Source]. 21389 * The source factory used to create [Source].
21333 */ 21390 */
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
22036 " default:", 22093 " default:",
22037 " continue l1;", 22094 " continue l1;",
22038 " }", 22095 " }",
22039 "}"])); 22096 "}"]));
22040 LibraryElement library = resolve(source); 22097 LibraryElement library = resolve(source);
22041 JUnitTestCase.assertNotNull(library); 22098 JUnitTestCase.assertNotNull(library);
22042 assertNoErrors(source); 22099 assertNoErrors(source);
22043 verify([source]); 22100 verify([source]);
22044 } 22101 }
22045 22102
22103 void test_localVariable_types_invoked() {
22104 Source source = addSource(EngineTestCase.createSource([
22105 "const A = null;",
22106 "main() {",
22107 " var myVar = (int p) => 'foo';",
22108 " myVar(42);",
22109 "}"]));
22110 LibraryElement library = resolve(source);
22111 JUnitTestCase.assertNotNull(library);
22112 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li brary);
22113 JUnitTestCase.assertNotNull(unit);
22114 List<bool> found = [false];
22115 unit.accept(new RecursiveASTVisitor_27(this, found));
22116 JUnitTestCase.assertTrue(found[0]);
22117 }
22118
22046 void test_metadata_class() { 22119 void test_metadata_class() {
22047 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@ A class C {}"])); 22120 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@ A class C {}"]));
22048 LibraryElement library = resolve(source); 22121 LibraryElement library = resolve(source);
22049 JUnitTestCase.assertNotNull(library); 22122 JUnitTestCase.assertNotNull(library);
22050 CompilationUnitElement unit = library.definingCompilationUnit; 22123 CompilationUnitElement unit = library.definingCompilationUnit;
22051 JUnitTestCase.assertNotNull(unit); 22124 JUnitTestCase.assertNotNull(unit);
22052 List<ClassElement> classes = unit.types; 22125 List<ClassElement> classes = unit.types;
22053 EngineTestCase.assertLength(1, classes); 22126 EngineTestCase.assertLength(1, classes);
22054 List<ElementAnnotation> annotations = classes[0].metadata; 22127 List<ElementAnnotation> annotations = classes[0].metadata;
22055 EngineTestCase.assertLength(1, annotations); 22128 EngineTestCase.assertLength(1, annotations);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
22373 runJUnitTest(__test, __test.test_isValidMixin_super); 22446 runJUnitTest(__test, __test.test_isValidMixin_super);
22374 }); 22447 });
22375 _ut.test('test_isValidMixin_valid', () { 22448 _ut.test('test_isValidMixin_valid', () {
22376 final __test = new SimpleResolverTest(); 22449 final __test = new SimpleResolverTest();
22377 runJUnitTest(__test, __test.test_isValidMixin_valid); 22450 runJUnitTest(__test, __test.test_isValidMixin_valid);
22378 }); 22451 });
22379 _ut.test('test_labels_switch', () { 22452 _ut.test('test_labels_switch', () {
22380 final __test = new SimpleResolverTest(); 22453 final __test = new SimpleResolverTest();
22381 runJUnitTest(__test, __test.test_labels_switch); 22454 runJUnitTest(__test, __test.test_labels_switch);
22382 }); 22455 });
22456 _ut.test('test_localVariable_types_invoked', () {
22457 final __test = new SimpleResolverTest();
22458 runJUnitTest(__test, __test.test_localVariable_types_invoked);
22459 });
22383 _ut.test('test_metadata_class', () { 22460 _ut.test('test_metadata_class', () {
22384 final __test = new SimpleResolverTest(); 22461 final __test = new SimpleResolverTest();
22385 runJUnitTest(__test, __test.test_metadata_class); 22462 runJUnitTest(__test, __test.test_metadata_class);
22386 }); 22463 });
22387 _ut.test('test_metadata_field', () { 22464 _ut.test('test_metadata_field', () {
22388 final __test = new SimpleResolverTest(); 22465 final __test = new SimpleResolverTest();
22389 runJUnitTest(__test, __test.test_metadata_field); 22466 runJUnitTest(__test, __test.test_metadata_field);
22390 }); 22467 });
22391 _ut.test('test_metadata_libraryDirective', () { 22468 _ut.test('test_metadata_libraryDirective', () {
22392 final __test = new SimpleResolverTest(); 22469 final __test = new SimpleResolverTest();
(...skipping 28 matching lines...) Expand all
22421 runJUnitTest(__test, __test.test_setter_inherited); 22498 runJUnitTest(__test, __test.test_setter_inherited);
22422 }); 22499 });
22423 _ut.test('test_setter_static', () { 22500 _ut.test('test_setter_static', () {
22424 final __test = new SimpleResolverTest(); 22501 final __test = new SimpleResolverTest();
22425 runJUnitTest(__test, __test.test_setter_static); 22502 runJUnitTest(__test, __test.test_setter_static);
22426 }); 22503 });
22427 }); 22504 });
22428 } 22505 }
22429 } 22506 }
22430 22507
22508 class RecursiveASTVisitor_27 extends RecursiveASTVisitor<Object> {
22509 final SimpleResolverTest SimpleResolverTest_this;
22510
22511 List<bool> found;
22512
22513 RecursiveASTVisitor_27(this.SimpleResolverTest_this, this.found) : super();
22514
22515 Object visitSimpleIdentifier(SimpleIdentifier node) {
22516 if (node.name == "myVar" && node.parent is MethodInvocation) {
22517 found[0] = true;
22518 Type2 staticType = node.staticType;
22519 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicType, staticType);
22520 FunctionType propagatedType = node.propagatedType as FunctionType;
22521 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringType , propagatedType.returnType);
22522 }
22523 return null;
22524 }
22525 }
22526
22431 class SubtypeManagerTest extends EngineTestCase { 22527 class SubtypeManagerTest extends EngineTestCase {
22432 /** 22528 /**
22433 * The inheritance manager being tested. 22529 * The inheritance manager being tested.
22434 */ 22530 */
22435 SubtypeManager _subtypeManager; 22531 SubtypeManager _subtypeManager;
22436 22532
22437 /** 22533 /**
22438 * The compilation unit element containing all of the types setup in each test . 22534 * The compilation unit element containing all of the types setup in each test .
22439 */ 22535 */
22440 CompilationUnitElementImpl _definingCompilationUnit; 22536 CompilationUnitElementImpl _definingCompilationUnit;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
22768 // HintCodeTest.dartSuite(); 22864 // HintCodeTest.dartSuite();
22769 // MemberMapTest.dartSuite(); 22865 // MemberMapTest.dartSuite();
22770 // NonHintCodeTest.dartSuite(); 22866 // NonHintCodeTest.dartSuite();
22771 // NonErrorResolverTest.dartSuite(); 22867 // NonErrorResolverTest.dartSuite();
22772 // SimpleResolverTest.dartSuite(); 22868 // SimpleResolverTest.dartSuite();
22773 // StaticTypeWarningCodeTest.dartSuite(); 22869 // StaticTypeWarningCodeTest.dartSuite();
22774 // StaticWarningCodeTest.dartSuite(); 22870 // StaticWarningCodeTest.dartSuite();
22775 // StrictModeTest.dartSuite(); 22871 // StrictModeTest.dartSuite();
22776 // TypePropagationTest.dartSuite(); 22872 // TypePropagationTest.dartSuite();
22777 } 22873 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/generated/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698