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

Unified Diff: pkg/analyzer/test/generated/element_test.dart

Issue 267293006: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/pubspec.yaml ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/element_test.dart
diff --git a/pkg/analyzer/test/generated/element_test.dart b/pkg/analyzer/test/generated/element_test.dart
index 485ffd91bce0f5102224a5c3fc05cdd656c7229a..b53ce4c471e2ed387508fd4afbd9dcdfdfad5a78 100644
--- a/pkg/analyzer/test/generated/element_test.dart
+++ b/pkg/analyzer/test/generated/element_test.dart
@@ -289,6 +289,47 @@ class ClassElementImplTest extends EngineTestCase {
JUnitTestCase.assertNull(classA.lookUpGetter("g", library));
}
+ void test_lookUpInheritedMethod_declared() {
+ LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement method = ElementFactory.methodElement(methodName, null, []);
+ classA.methods = <MethodElement> [method];
+ (library.definingCompilationUnit as CompilationUnitElementImpl).types = <ClassElement> [classA];
+ JUnitTestCase.assertNull(classA.lookUpInheritedMethod(methodName, library));
+ }
+
+ void test_lookUpInheritedMethod_declaredAndInherited() {
+ LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement inheritedMethod = ElementFactory.methodElement(methodName, null, []);
+ classA.methods = <MethodElement> [inheritedMethod];
+ ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
+ MethodElement method = ElementFactory.methodElement(methodName, null, []);
+ classB.methods = <MethodElement> [method];
+ (library.definingCompilationUnit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB];
+ JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(methodName, library));
+ }
+
+ void test_lookUpInheritedMethod_inherited() {
+ LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement inheritedMethod = ElementFactory.methodElement(methodName, null, []);
+ classA.methods = <MethodElement> [inheritedMethod];
+ ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
+ (library.definingCompilationUnit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB];
+ JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(methodName, library));
+ }
+
+ void test_lookUpInheritedMethod_undeclared() {
+ LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ (library.definingCompilationUnit as CompilationUnitElementImpl).types = <ClassElement> [classA];
+ JUnitTestCase.assertNull(classA.lookUpInheritedMethod("m", library));
+ }
+
void test_lookUpMethod_declared() {
LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
ClassElementImpl classA = ElementFactory.classElement2("A", []);
@@ -453,6 +494,22 @@ class ClassElementImplTest extends EngineTestCase {
final __test = new ClassElementImplTest();
runJUnitTest(__test, __test.test_lookUpGetter_undeclared_recursive);
});
+ _ut.test('test_lookUpInheritedMethod_declared', () {
+ final __test = new ClassElementImplTest();
+ runJUnitTest(__test, __test.test_lookUpInheritedMethod_declared);
+ });
+ _ut.test('test_lookUpInheritedMethod_declaredAndInherited', () {
+ final __test = new ClassElementImplTest();
+ runJUnitTest(__test, __test.test_lookUpInheritedMethod_declaredAndInherited);
+ });
+ _ut.test('test_lookUpInheritedMethod_inherited', () {
+ final __test = new ClassElementImplTest();
+ runJUnitTest(__test, __test.test_lookUpInheritedMethod_inherited);
+ });
+ _ut.test('test_lookUpInheritedMethod_undeclared', () {
+ final __test = new ClassElementImplTest();
+ runJUnitTest(__test, __test.test_lookUpInheritedMethod_undeclared);
+ });
_ut.test('test_lookUpMethod_declared', () {
final __test = new ClassElementImplTest();
runJUnitTest(__test, __test.test_lookUpMethod_declared);
« no previous file with comments | « pkg/analyzer/pubspec.yaml ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698