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

Side by Side Diff: pkg/analyzer/test/generated/element_test.dart

Issue 1150863007: Remove many explicit references to AnalysisContextImpl and enable testing of the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
11 import 'package:analyzer/src/generated/element.dart'; 11 import 'package:analyzer/src/generated/element.dart';
12 import 'package:analyzer/src/generated/engine.dart' 12 import 'package:analyzer/src/generated/engine.dart'
13 show AnalysisContext, AnalysisContextImpl, 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 '../reflective_tests.dart';
22 import 'resolver_test.dart' show TestTypeProvider, AnalysisContextHelper; 22 import 'resolver_test.dart' show TestTypeProvider, AnalysisContextHelper;
23 import 'test_support.dart'; 23 import 'test_support.dart';
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 FieldElement field = ElementFactory.fieldElement( 1057 FieldElement field = ElementFactory.fieldElement(
1058 "next", false, false, false, classElement.type); 1058 "next", false, false, false, classElement.type);
1059 classElement.fields = <FieldElement>[field]; 1059 classElement.fields = <FieldElement>[field];
1060 expect(field == field, isTrue); 1060 expect(field == field, isTrue);
1061 expect(field == field.getter, isFalse); 1061 expect(field == field.getter, isFalse);
1062 expect(field == field.setter, isFalse); 1062 expect(field == field.setter, isFalse);
1063 expect(field.getter == field.setter, isFalse); 1063 expect(field.getter == field.setter, isFalse);
1064 } 1064 }
1065 1065
1066 void test_isAccessibleIn_private_differentLibrary() { 1066 void test_isAccessibleIn_private_differentLibrary() {
1067 AnalysisContextImpl context = createAnalysisContext(); 1067 AnalysisContext context = createAnalysisContext();
1068 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); 1068 LibraryElementImpl library1 = ElementFactory.library(context, "lib1");
1069 ClassElement classElement = ElementFactory.classElement2("_C"); 1069 ClassElement classElement = ElementFactory.classElement2("_C");
1070 (library1.definingCompilationUnit as CompilationUnitElementImpl).types = 1070 (library1.definingCompilationUnit as CompilationUnitElementImpl).types =
1071 <ClassElement>[classElement]; 1071 <ClassElement>[classElement];
1072 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); 1072 LibraryElementImpl library2 = ElementFactory.library(context, "lib2");
1073 expect(classElement.isAccessibleIn(library2), isFalse); 1073 expect(classElement.isAccessibleIn(library2), isFalse);
1074 } 1074 }
1075 1075
1076 void test_isAccessibleIn_private_sameLibrary() { 1076 void test_isAccessibleIn_private_sameLibrary() {
1077 LibraryElementImpl library = 1077 LibraryElementImpl library =
1078 ElementFactory.library(createAnalysisContext(), "lib"); 1078 ElementFactory.library(createAnalysisContext(), "lib");
1079 ClassElement classElement = ElementFactory.classElement2("_C"); 1079 ClassElement classElement = ElementFactory.classElement2("_C");
1080 (library.definingCompilationUnit as CompilationUnitElementImpl).types = 1080 (library.definingCompilationUnit as CompilationUnitElementImpl).types =
1081 <ClassElement>[classElement]; 1081 <ClassElement>[classElement];
1082 expect(classElement.isAccessibleIn(library), isTrue); 1082 expect(classElement.isAccessibleIn(library), isTrue);
1083 } 1083 }
1084 1084
1085 void test_isAccessibleIn_public_differentLibrary() { 1085 void test_isAccessibleIn_public_differentLibrary() {
1086 AnalysisContextImpl context = createAnalysisContext(); 1086 AnalysisContext context = createAnalysisContext();
1087 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); 1087 LibraryElementImpl library1 = ElementFactory.library(context, "lib1");
1088 ClassElement classElement = ElementFactory.classElement2("C"); 1088 ClassElement classElement = ElementFactory.classElement2("C");
1089 (library1.definingCompilationUnit as CompilationUnitElementImpl).types = 1089 (library1.definingCompilationUnit as CompilationUnitElementImpl).types =
1090 <ClassElement>[classElement]; 1090 <ClassElement>[classElement];
1091 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); 1091 LibraryElementImpl library2 = ElementFactory.library(context, "lib2");
1092 expect(classElement.isAccessibleIn(library2), isTrue); 1092 expect(classElement.isAccessibleIn(library2), isTrue);
1093 } 1093 }
1094 1094
1095 void test_isAccessibleIn_public_sameLibrary() { 1095 void test_isAccessibleIn_public_sameLibrary() {
1096 LibraryElementImpl library = 1096 LibraryElementImpl library =
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 ElementFactory.functionTypeAliasElement('f'); 1953 ElementFactory.functionTypeAliasElement('f');
1954 ClassElementImpl c = ElementFactory.classElement2('C', ['T']); 1954 ClassElementImpl c = ElementFactory.classElement2('C', ['T']);
1955 f.returnType = c.type.substitute4([f.type]); 1955 f.returnType = c.type.substitute4([f.type]);
1956 expect(f.type.toString(), '() \u2192 C<...>'); 1956 expect(f.type.toString(), '() \u2192 C<...>');
1957 } 1957 }
1958 } 1958 }
1959 1959
1960 @reflectiveTest 1960 @reflectiveTest
1961 class HtmlElementImplTest extends EngineTestCase { 1961 class HtmlElementImplTest extends EngineTestCase {
1962 void test_equals_differentSource() { 1962 void test_equals_differentSource() {
1963 AnalysisContextImpl context = createAnalysisContext(); 1963 AnalysisContext context = createAnalysisContext();
1964 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html"); 1964 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html");
1965 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html"); 1965 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html");
1966 expect(elementA == elementB, isFalse); 1966 expect(elementA == elementB, isFalse);
1967 } 1967 }
1968 1968
1969 void test_equals_null() { 1969 void test_equals_null() {
1970 AnalysisContextImpl context = createAnalysisContext(); 1970 AnalysisContext context = createAnalysisContext();
1971 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); 1971 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html");
1972 expect(element == null, isFalse); 1972 expect(element == null, isFalse);
1973 } 1973 }
1974 1974
1975 void test_equals_sameSource() { 1975 void test_equals_sameSource() {
1976 AnalysisContextImpl context = createAnalysisContext(); 1976 AnalysisContext context = createAnalysisContext();
1977 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "index.html"); 1977 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "index.html");
1978 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "index.html"); 1978 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "index.html");
1979 expect(elementA == elementB, isTrue); 1979 expect(elementA == elementB, isTrue);
1980 } 1980 }
1981 1981
1982 void test_equals_self() { 1982 void test_equals_self() {
1983 AnalysisContextImpl context = createAnalysisContext(); 1983 AnalysisContext context = createAnalysisContext();
1984 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); 1984 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html");
1985 expect(element == element, isTrue); 1985 expect(element == element, isTrue);
1986 } 1986 }
1987 } 1987 }
1988 1988
1989 @reflectiveTest 1989 @reflectiveTest
1990 class InterfaceTypeImplTest extends EngineTestCase { 1990 class InterfaceTypeImplTest extends EngineTestCase {
1991 /** 1991 /**
1992 * The type provider used to access the types. 1992 * The type provider used to access the types.
1993 */ 1993 */
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 } 4220 }
4221 4221
4222 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction 4222 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction
4223 extends InterfaceTypeImpl { 4223 extends InterfaceTypeImpl {
4224 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) 4224 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0)
4225 : super(arg0); 4225 : super(arg0);
4226 4226
4227 @override 4227 @override
4228 bool get isDartCoreFunction => true; 4228 bool get isDartCoreFunction => true;
4229 } 4229 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698