Index: pkg/analyzer/test/src/dart/element/element_test.dart |
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart |
index 0cff4a6c3e87f98429bfc190eed7094950e6b9cd..2eef5fdeb509d13572eeda0e9d19c09e0152f8b0 100644 |
--- a/pkg/analyzer/test/src/dart/element/element_test.dart |
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart |
@@ -964,96 +964,6 @@ abstract class A<K, V> = Object with MapMixin<K, V>; |
@reflectiveTest |
class CompilationUnitElementImplTest extends EngineTestCase { |
- void test_getElementAt() { |
- AnalysisContextHelper contextHelper = new AnalysisContextHelper(); |
- AnalysisContext context = contextHelper.context; |
- String code = r''' |
-class A { |
- int field; |
-} |
-main() { |
- int localVar = 42; |
-} |
-'''; |
- Source libSource = contextHelper.addSource("/my_lib.dart", code); |
- // prepare library/unit elements |
- LibraryElement libraryElement = context.computeLibraryElement(libSource); |
- CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; |
- // A |
- ClassElement elementA; |
- { |
- int offset = code.indexOf('A {'); |
- elementA = unitElement.getElementAt(offset); |
- expect(elementA, isNotNull); |
- expect(elementA.enclosingElement, unitElement); |
- expect(elementA.name, 'A'); |
- } |
- // A.field |
- { |
- int offset = code.indexOf('field;'); |
- FieldElement element = unitElement.getElementAt(offset); |
- expect(element, isNotNull); |
- expect(element.enclosingElement, elementA); |
- expect(element.name, 'field'); |
- } |
- // main |
- FunctionElement mainElement; |
- { |
- int offset = code.indexOf('main() {'); |
- mainElement = unitElement.getElementAt(offset); |
- expect(mainElement, isNotNull); |
- expect(mainElement.enclosingElement, unitElement); |
- expect(mainElement.name, 'main'); |
- } |
- // main.localVar |
- { |
- int offset = code.indexOf('localVar'); |
- LocalVariableElement element = unitElement.getElementAt(offset); |
- expect(element, isNotNull); |
- expect(element.enclosingElement, mainElement); |
- expect(element.name, 'localVar'); |
- } |
- // null |
- expect(unitElement.getElementAt(1000), isNull); |
- } |
- |
- void test_getElementAt_multipleUnitsInLibrary() { |
- AnalysisContextHelper contextHelper = new AnalysisContextHelper(); |
- AnalysisContext context = contextHelper.context; |
- Source libSource = contextHelper.addSource( |
- "/my_lib.dart", |
- r''' |
-library my_lib; |
-part 'unit_a.dart'; |
-part 'unit_b.dart'; |
-'''); |
- Source unitSourceA = |
- contextHelper.addSource("/unit_a.dart", 'part of my_lib;class A {}'); |
- Source unitSourceB = |
- contextHelper.addSource("/unit_b.dart", 'part of my_lib;class B {}'); |
- int offset = 'part of my_lib;class A {}'.indexOf('A {}'); |
- // prepare library/unit elements |
- context.computeLibraryElement(libSource); |
- CompilationUnitElement unitElementA = |
- context.getCompilationUnitElement(unitSourceA, libSource); |
- CompilationUnitElement unitElementB = |
- context.getCompilationUnitElement(unitSourceB, libSource); |
- // A |
- { |
- ClassElement element = unitElementA.getElementAt(offset); |
- expect(element, isNotNull); |
- expect(element.enclosingElement, unitElementA); |
- expect(element.name, 'A'); |
- } |
- // B |
- { |
- ClassElement element = unitElementB.getElementAt(offset); |
- expect(element, isNotNull); |
- expect(element.enclosingElement, unitElementB); |
- expect(element.name, 'B'); |
- } |
- } |
- |
void test_getEnum_declared() { |
TestTypeProvider typeProvider = new TestTypeProvider(); |
CompilationUnitElementImpl unit = |