| 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.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); | 3262 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); |
| 3263 // the opposite test tests a different branch in isMoreSpecificThan() | 3263 // the opposite test tests a different branch in isMoreSpecificThan() |
| 3264 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); | 3264 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); |
| 3265 } | 3265 } |
| 3266 | 3266 |
| 3267 void test_isMoreSpecificThan_dynamic() { | 3267 void test_isMoreSpecificThan_dynamic() { |
| 3268 InterfaceType type = ElementFactory.classElement2("A", []).type; | 3268 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 3269 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); | 3269 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 void test_isMoreSpecificThan_generic() { |
| 3273 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 3274 ClassElement classB = ElementFactory.classElement2("B", []); |
| 3275 DartType dynamicType = DynamicTypeImpl.instance; |
| 3276 InterfaceType typeAOfDynamic = classA.type.substitute4(<DartType> [dynamicTy
pe]); |
| 3277 InterfaceType typeAOfB = classA.type.substitute4(<DartType> [classB.type]); |
| 3278 JUnitTestCase.assertFalse(typeAOfDynamic.isMoreSpecificThan(typeAOfB)); |
| 3279 JUnitTestCase.assertTrue(typeAOfB.isMoreSpecificThan(typeAOfDynamic)); |
| 3280 } |
| 3281 |
| 3272 void test_isMoreSpecificThan_self() { | 3282 void test_isMoreSpecificThan_self() { |
| 3273 InterfaceType type = ElementFactory.classElement2("A", []).type; | 3283 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 3274 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); | 3284 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 3275 } | 3285 } |
| 3276 | 3286 |
| 3277 void test_isMoreSpecificThan_transitive_interface() { | 3287 void test_isMoreSpecificThan_transitive_interface() { |
| 3278 // | 3288 // |
| 3279 // class A {} | 3289 // class A {} |
| 3280 // class B extends A {} | 3290 // class B extends A {} |
| 3281 // class C implements B {} | 3291 // class C implements B {} |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 // void call(String s) {} | 3395 // void call(String s) {} |
| 3386 // } | 3396 // } |
| 3387 // | 3397 // |
| 3388 InterfaceType stringType = _typeProvider.stringType; | 3398 InterfaceType stringType = _typeProvider.stringType; |
| 3389 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3399 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3390 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; | 3400 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; |
| 3391 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; | 3401 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; |
| 3392 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); | 3402 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); |
| 3393 } | 3403 } |
| 3394 | 3404 |
| 3405 void test_isSubtypeOf_generic() { |
| 3406 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 3407 ClassElement classB = ElementFactory.classElement2("B", []); |
| 3408 DartType dynamicType = DynamicTypeImpl.instance; |
| 3409 InterfaceType typeAOfDynamic = classA.type.substitute4(<DartType> [dynamicTy
pe]); |
| 3410 InterfaceType typeAOfB = classA.type.substitute4(<DartType> [classB.type]); |
| 3411 JUnitTestCase.assertTrue(typeAOfDynamic.isSubtypeOf(typeAOfB)); |
| 3412 JUnitTestCase.assertTrue(typeAOfB.isSubtypeOf(typeAOfDynamic)); |
| 3413 } |
| 3414 |
| 3395 void test_isSubtypeOf_interface() { | 3415 void test_isSubtypeOf_interface() { |
| 3396 ClassElement classA = ElementFactory.classElement2("A", []); | 3416 ClassElement classA = ElementFactory.classElement2("A", []); |
| 3397 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 3417 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 3398 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 3418 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 3399 InterfaceType typeObject = classA.supertype; | 3419 InterfaceType typeObject = classA.supertype; |
| 3400 InterfaceType typeA = classA.type; | 3420 InterfaceType typeA = classA.type; |
| 3401 InterfaceType typeB = classB.type; | 3421 InterfaceType typeB = classB.type; |
| 3402 InterfaceType typeC = classC.type; | 3422 InterfaceType typeC = classC.type; |
| 3403 classC.interfaces = <InterfaceType> [typeB]; | 3423 classC.interfaces = <InterfaceType> [typeB]; |
| 3404 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 3424 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 runJUnitTest(__test, __test.test_isMoreSpecificThan_covariance); | 4113 runJUnitTest(__test, __test.test_isMoreSpecificThan_covariance); |
| 4094 }); | 4114 }); |
| 4095 _ut.test('test_isMoreSpecificThan_directSupertype', () { | 4115 _ut.test('test_isMoreSpecificThan_directSupertype', () { |
| 4096 final __test = new InterfaceTypeImplTest(); | 4116 final __test = new InterfaceTypeImplTest(); |
| 4097 runJUnitTest(__test, __test.test_isMoreSpecificThan_directSupertype); | 4117 runJUnitTest(__test, __test.test_isMoreSpecificThan_directSupertype); |
| 4098 }); | 4118 }); |
| 4099 _ut.test('test_isMoreSpecificThan_dynamic', () { | 4119 _ut.test('test_isMoreSpecificThan_dynamic', () { |
| 4100 final __test = new InterfaceTypeImplTest(); | 4120 final __test = new InterfaceTypeImplTest(); |
| 4101 runJUnitTest(__test, __test.test_isMoreSpecificThan_dynamic); | 4121 runJUnitTest(__test, __test.test_isMoreSpecificThan_dynamic); |
| 4102 }); | 4122 }); |
| 4123 _ut.test('test_isMoreSpecificThan_generic', () { |
| 4124 final __test = new InterfaceTypeImplTest(); |
| 4125 runJUnitTest(__test, __test.test_isMoreSpecificThan_generic); |
| 4126 }); |
| 4103 _ut.test('test_isMoreSpecificThan_self', () { | 4127 _ut.test('test_isMoreSpecificThan_self', () { |
| 4104 final __test = new InterfaceTypeImplTest(); | 4128 final __test = new InterfaceTypeImplTest(); |
| 4105 runJUnitTest(__test, __test.test_isMoreSpecificThan_self); | 4129 runJUnitTest(__test, __test.test_isMoreSpecificThan_self); |
| 4106 }); | 4130 }); |
| 4107 _ut.test('test_isMoreSpecificThan_transitive_interface', () { | 4131 _ut.test('test_isMoreSpecificThan_transitive_interface', () { |
| 4108 final __test = new InterfaceTypeImplTest(); | 4132 final __test = new InterfaceTypeImplTest(); |
| 4109 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_interface
); | 4133 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_interface
); |
| 4110 }); | 4134 }); |
| 4111 _ut.test('test_isMoreSpecificThan_transitive_mixin', () { | 4135 _ut.test('test_isMoreSpecificThan_transitive_mixin', () { |
| 4112 final __test = new InterfaceTypeImplTest(); | 4136 final __test = new InterfaceTypeImplTest(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 4133 runJUnitTest(__test, __test.test_isSubtypeOf_directSubtype); | 4157 runJUnitTest(__test, __test.test_isSubtypeOf_directSubtype); |
| 4134 }); | 4158 }); |
| 4135 _ut.test('test_isSubtypeOf_dynamic', () { | 4159 _ut.test('test_isSubtypeOf_dynamic', () { |
| 4136 final __test = new InterfaceTypeImplTest(); | 4160 final __test = new InterfaceTypeImplTest(); |
| 4137 runJUnitTest(__test, __test.test_isSubtypeOf_dynamic); | 4161 runJUnitTest(__test, __test.test_isSubtypeOf_dynamic); |
| 4138 }); | 4162 }); |
| 4139 _ut.test('test_isSubtypeOf_function', () { | 4163 _ut.test('test_isSubtypeOf_function', () { |
| 4140 final __test = new InterfaceTypeImplTest(); | 4164 final __test = new InterfaceTypeImplTest(); |
| 4141 runJUnitTest(__test, __test.test_isSubtypeOf_function); | 4165 runJUnitTest(__test, __test.test_isSubtypeOf_function); |
| 4142 }); | 4166 }); |
| 4167 _ut.test('test_isSubtypeOf_generic', () { |
| 4168 final __test = new InterfaceTypeImplTest(); |
| 4169 runJUnitTest(__test, __test.test_isSubtypeOf_generic); |
| 4170 }); |
| 4143 _ut.test('test_isSubtypeOf_interface', () { | 4171 _ut.test('test_isSubtypeOf_interface', () { |
| 4144 final __test = new InterfaceTypeImplTest(); | 4172 final __test = new InterfaceTypeImplTest(); |
| 4145 runJUnitTest(__test, __test.test_isSubtypeOf_interface); | 4173 runJUnitTest(__test, __test.test_isSubtypeOf_interface); |
| 4146 }); | 4174 }); |
| 4147 _ut.test('test_isSubtypeOf_mixins', () { | 4175 _ut.test('test_isSubtypeOf_mixins', () { |
| 4148 final __test = new InterfaceTypeImplTest(); | 4176 final __test = new InterfaceTypeImplTest(); |
| 4149 runJUnitTest(__test, __test.test_isSubtypeOf_mixins); | 4177 runJUnitTest(__test, __test.test_isSubtypeOf_mixins); |
| 4150 }); | 4178 }); |
| 4151 _ut.test('test_isSubtypeOf_object', () { | 4179 _ut.test('test_isSubtypeOf_object', () { |
| 4152 final __test = new InterfaceTypeImplTest(); | 4180 final __test = new InterfaceTypeImplTest(); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4760 InterfaceTypeImplTest.dartSuite(); | 4788 InterfaceTypeImplTest.dartSuite(); |
| 4761 TypeParameterTypeImplTest.dartSuite(); | 4789 TypeParameterTypeImplTest.dartSuite(); |
| 4762 VoidTypeImplTest.dartSuite(); | 4790 VoidTypeImplTest.dartSuite(); |
| 4763 ClassElementImplTest.dartSuite(); | 4791 ClassElementImplTest.dartSuite(); |
| 4764 ElementLocationImplTest.dartSuite(); | 4792 ElementLocationImplTest.dartSuite(); |
| 4765 ElementImplTest.dartSuite(); | 4793 ElementImplTest.dartSuite(); |
| 4766 HtmlElementImplTest.dartSuite(); | 4794 HtmlElementImplTest.dartSuite(); |
| 4767 LibraryElementImplTest.dartSuite(); | 4795 LibraryElementImplTest.dartSuite(); |
| 4768 MultiplyDefinedElementImplTest.dartSuite(); | 4796 MultiplyDefinedElementImplTest.dartSuite(); |
| 4769 } | 4797 } |
| OLD | NEW |