| 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 analyzer.test.generated.element_test; | 5 library analyzer.test.generated.element_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/element/type.dart'; | 10 import 'package:analyzer/src/dart/element/type.dart'; |
| 11 import 'package:analyzer/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart' | 12 import 'package:analyzer/src/generated/engine.dart' |
| 13 show AnalysisContext, AnalysisOptionsImpl; | 13 show AnalysisContext, AnalysisOptionsImpl; |
| 14 import 'package:analyzer/src/generated/java_core.dart'; | 14 import 'package:analyzer/src/generated/java_core.dart'; |
| 15 import 'package:analyzer/src/generated/source_io.dart'; | 15 import 'package:analyzer/src/generated/source_io.dart'; |
| 16 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 16 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 17 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 17 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 18 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 18 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 19 import 'package:unittest/unittest.dart'; | 19 import 'package:unittest/unittest.dart'; |
| 20 | 20 |
| 21 import '../reflective_tests.dart'; | 21 import '../../../generated/resolver_test.dart' |
| 22 import '../utils.dart'; | 22 show TestTypeProvider, AnalysisContextHelper; |
| 23 import 'resolver_test.dart' show TestTypeProvider, AnalysisContextHelper; | 23 import '../../../generated/test_support.dart'; |
| 24 import 'test_support.dart'; | 24 import '../../../reflective_tests.dart'; |
| 25 import '../../../utils.dart'; |
| 25 | 26 |
| 26 main() { | 27 main() { |
| 27 initializeTestEnvironment(); | 28 initializeTestEnvironment(); |
| 28 runReflectiveTests(ElementKindTest); | |
| 29 runReflectiveTests(FieldElementImplTest); | 29 runReflectiveTests(FieldElementImplTest); |
| 30 runReflectiveTests(FunctionTypeImplTest); | 30 runReflectiveTests(FunctionTypeImplTest); |
| 31 runReflectiveTests(InterfaceTypeImplTest); | 31 runReflectiveTests(InterfaceTypeImplTest); |
| 32 runReflectiveTests(TypeParameterTypeImplTest); | 32 runReflectiveTests(TypeParameterTypeImplTest); |
| 33 runReflectiveTests(VoidTypeImplTest); | 33 runReflectiveTests(VoidTypeImplTest); |
| 34 runReflectiveTests(ClassElementImplTest); | 34 runReflectiveTests(ClassElementImplTest); |
| 35 runReflectiveTests(CompilationUnitElementImplTest); | 35 runReflectiveTests(CompilationUnitElementImplTest); |
| 36 runReflectiveTests(ElementLocationImplTest); | 36 runReflectiveTests(ElementLocationImplTest); |
| 37 runReflectiveTests(ElementImplTest); | 37 runReflectiveTests(ElementImplTest); |
| 38 runReflectiveTests(LibraryElementImplTest); | 38 runReflectiveTests(LibraryElementImplTest); |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 classElementA.nameOffset = 1; | 1160 classElementA.nameOffset = 1; |
| 1161 ClassElementImpl classElementB = ElementFactory.classElement2("B"); | 1161 ClassElementImpl classElementB = ElementFactory.classElement2("B"); |
| 1162 classElementB.nameOffset = 2; | 1162 classElementB.nameOffset = 2; |
| 1163 expect(Element.SORT_BY_OFFSET(classElementA, classElementA), 0); | 1163 expect(Element.SORT_BY_OFFSET(classElementA, classElementA), 0); |
| 1164 expect(Element.SORT_BY_OFFSET(classElementA, classElementB) < 0, isTrue); | 1164 expect(Element.SORT_BY_OFFSET(classElementA, classElementB) < 0, isTrue); |
| 1165 expect(Element.SORT_BY_OFFSET(classElementB, classElementA) > 0, isTrue); | 1165 expect(Element.SORT_BY_OFFSET(classElementB, classElementA) > 0, isTrue); |
| 1166 } | 1166 } |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 @reflectiveTest | 1169 @reflectiveTest |
| 1170 class ElementKindTest extends EngineTestCase { | |
| 1171 void test_of_nonNull() { | |
| 1172 expect(ElementKind.of(ElementFactory.classElement2("A")), | |
| 1173 same(ElementKind.CLASS)); | |
| 1174 } | |
| 1175 | |
| 1176 void test_of_null() { | |
| 1177 expect(ElementKind.of(null), same(ElementKind.ERROR)); | |
| 1178 } | |
| 1179 } | |
| 1180 | |
| 1181 @reflectiveTest | |
| 1182 class ElementLocationImplTest extends EngineTestCase { | 1170 class ElementLocationImplTest extends EngineTestCase { |
| 1183 void test_create_encoding() { | 1171 void test_create_encoding() { |
| 1184 String encoding = "a;b;c"; | 1172 String encoding = "a;b;c"; |
| 1185 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 1173 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 1186 expect(location.encoding, encoding); | 1174 expect(location.encoding, encoding); |
| 1187 } | 1175 } |
| 1188 | 1176 |
| 1189 /** | 1177 /** |
| 1190 * For example unnamed constructor. | 1178 * For example unnamed constructor. |
| 1191 */ | 1179 */ |
| (...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4010 } | 3998 } |
| 4011 | 3999 |
| 4012 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction | 4000 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction |
| 4013 extends InterfaceTypeImpl { | 4001 extends InterfaceTypeImpl { |
| 4014 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) | 4002 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) |
| 4015 : super(arg0); | 4003 : super(arg0); |
| 4016 | 4004 |
| 4017 @override | 4005 @override |
| 4018 bool get isDartCoreFunction => true; | 4006 bool get isDartCoreFunction => true; |
| 4019 } | 4007 } |
| OLD | NEW |