| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 121 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 122 String methodName = "m"; | 122 String methodName = "m"; |
| 123 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 123 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 124 classA.methods = <MethodElement> [method]; | 124 classA.methods = <MethodElement> [method]; |
| 125 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); | 125 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void test_getNode() { | 128 void test_getNode() { |
| 129 AnalysisContextHelper contextHelper = new AnalysisContextHelper(); | 129 AnalysisContextHelper contextHelper = new AnalysisContextHelper(); |
| 130 AnalysisContext context = contextHelper.context; | 130 AnalysisContext context = contextHelper.context; |
| 131 Source source = contextHelper.addSource("/test.dart", EngineTestCase.createS
ource(["class A {}", "class B {}"])); | 131 Source source = contextHelper.addSource("/test.dart", r''' |
| 132 class A {} |
| 133 class B {}'''); |
| 132 // prepare CompilationUnitElement | 134 // prepare CompilationUnitElement |
| 133 LibraryElement libraryElement = context.computeLibraryElement(source); | 135 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 134 CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; | 136 CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; |
| 135 // A | 137 // A |
| 136 { | 138 { |
| 137 ClassElement elementA = unitElement.getType("A"); | 139 ClassElement elementA = unitElement.getType("A"); |
| 138 ClassDeclaration nodeA = elementA.node; | 140 ClassDeclaration nodeA = elementA.node; |
| 139 JUnitTestCase.assertNotNull(nodeA); | 141 JUnitTestCase.assertNotNull(nodeA); |
| 140 JUnitTestCase.assertEquals("A", nodeA.name.name); | 142 JUnitTestCase.assertEquals("A", nodeA.name.name); |
| 141 JUnitTestCase.assertSame(elementA, nodeA.element); | 143 JUnitTestCase.assertSame(elementA, nodeA.element); |
| (...skipping 3336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3478 runReflectiveTests(UnionTypeImplTest); | 3480 runReflectiveTests(UnionTypeImplTest); |
| 3479 runReflectiveTests(VoidTypeImplTest); | 3481 runReflectiveTests(VoidTypeImplTest); |
| 3480 runReflectiveTests(ClassElementImplTest); | 3482 runReflectiveTests(ClassElementImplTest); |
| 3481 runReflectiveTests(CompilationUnitElementImplTest); | 3483 runReflectiveTests(CompilationUnitElementImplTest); |
| 3482 runReflectiveTests(ElementLocationImplTest); | 3484 runReflectiveTests(ElementLocationImplTest); |
| 3483 runReflectiveTests(ElementImplTest); | 3485 runReflectiveTests(ElementImplTest); |
| 3484 runReflectiveTests(HtmlElementImplTest); | 3486 runReflectiveTests(HtmlElementImplTest); |
| 3485 runReflectiveTests(LibraryElementImplTest); | 3487 runReflectiveTests(LibraryElementImplTest); |
| 3486 runReflectiveTests(MultiplyDefinedElementImplTest); | 3488 runReflectiveTests(MultiplyDefinedElementImplTest); |
| 3487 } | 3489 } |
| OLD | NEW |