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

Unified Diff: pkg/analyzer/test/src/dart/element/element_test.dart

Issue 2524903002: Rename AstFactory -> AstTestFactory. (Closed)
Patch Set: Created 4 years, 1 month 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
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 f659b070feebb0d848cf5fdfd7febb73277e6ac0..5c691e32c5e920c722fad008f15a6ce339eabdf9 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -14,7 +14,7 @@ import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisOptionsImpl;
import 'package:analyzer/src/generated/source_io.dart';
-import 'package:analyzer/src/generated/testing/ast_factory.dart';
+import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/testing/test_type_provider.dart';
import 'package:test/test.dart';
@@ -1329,7 +1329,7 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_creation() {
expect(
new FunctionTypeImpl(
- new FunctionElementImpl.forNode(AstFactory.identifier3("f"))),
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f"))),
isNotNull);
}
@@ -1353,7 +1353,7 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_getElement() {
FunctionElementImpl typeElement =
- new FunctionElementImpl.forNode(AstFactory.identifier3("f"));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f"));
FunctionTypeImpl type = new FunctionTypeImpl(typeElement);
expect(type.element, typeElement);
}
@@ -1465,7 +1465,7 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_getReturnType() {
DartType expectedReturnType = VoidTypeImpl.instance;
FunctionElementImpl functionElement =
- new FunctionElementImpl.forNode(AstFactory.identifier3("f"));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f"));
functionElement.returnType = expectedReturnType;
FunctionTypeImpl type = new FunctionTypeImpl(functionElement);
DartType returnType = type.returnType;
@@ -1474,14 +1474,14 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_getTypeArguments() {
FunctionTypeImpl type = new FunctionTypeImpl(
- new FunctionElementImpl.forNode(AstFactory.identifier3("f")));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f")));
List<DartType> types = type.typeArguments;
expect(types, hasLength(0));
}
void test_hashCode_element() {
FunctionTypeImpl type = new FunctionTypeImpl(
- new FunctionElementImpl.forNode(AstFactory.identifier3("f")));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f")));
type.hashCode;
}
@@ -1841,15 +1841,15 @@ class FunctionTypeImplTest extends EngineTestCase {
InterfaceType boolType = provider.boolType;
InterfaceType stringType = provider.stringType;
TypeParameterElementImpl parameterB =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("B"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("B"));
parameterB.bound = boolType;
TypeParameterTypeImpl typeB = new TypeParameterTypeImpl(parameterB);
TypeParameterElementImpl parameterS =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("S"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("S"));
parameterS.bound = stringType;
TypeParameterTypeImpl typeS = new TypeParameterTypeImpl(parameterS);
FunctionElementImpl functionAliasElement =
- new FunctionElementImpl.forNode(AstFactory.identifier3("func"));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("func"));
functionAliasElement.parameters = <ParameterElement>[
ElementFactory.requiredParameter2("a", typeB),
ElementFactory.positionalParameter2("b", typeS)
@@ -1859,7 +1859,7 @@ class FunctionTypeImplTest extends EngineTestCase {
new FunctionTypeImpl(functionAliasElement);
functionAliasElement.type = functionAliasType;
FunctionElementImpl functionElement =
- new FunctionElementImpl.forNode(AstFactory.identifier3("f"));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f"));
functionElement.parameters = <ParameterElement>[
ElementFactory.requiredParameter2("c", boolType),
ElementFactory.positionalParameter2("d", stringType)
@@ -2041,7 +2041,7 @@ class FunctionTypeImplTest extends EngineTestCase {
ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]);
TypeParameterType parameterType = definingClass.typeParameters[0].type;
MethodElementImpl functionElement =
- new MethodElementImpl.forNode(AstFactory.identifier3("m"));
+ new MethodElementImpl.forNode(AstTestFactory.identifier3("m"));
String namedParameterName = "c";
functionElement.parameters = <ParameterElement>[
ElementFactory.requiredParameter2("a", parameterType),
@@ -2052,7 +2052,7 @@ class FunctionTypeImplTest extends EngineTestCase {
definingClass.methods = <MethodElement>[functionElement];
FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement);
InterfaceTypeImpl argumentType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("D")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("D")));
FunctionType result = functionType
.substitute2(<DartType>[argumentType], <DartType>[parameterType]);
expect(result.returnType, argumentType);
@@ -2069,15 +2069,15 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_substitute2_notEqual() {
DartType returnType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("R")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("R")));
DartType normalParameterType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("A")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("A")));
DartType optionalParameterType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("B")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("B")));
DartType namedParameterType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("C")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("C")));
FunctionElementImpl functionElement =
- new FunctionElementImpl.forNode(AstFactory.identifier3("f"));
+ new FunctionElementImpl.forNode(AstTestFactory.identifier3("f"));
String namedParameterName = "c";
functionElement.parameters = <ParameterElement>[
ElementFactory.requiredParameter2("a", normalParameterType),
@@ -2087,9 +2087,9 @@ class FunctionTypeImplTest extends EngineTestCase {
functionElement.returnType = returnType;
FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement);
InterfaceTypeImpl argumentType = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("D")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("D")));
TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E")));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E")));
FunctionType result = functionType
.substitute2(<DartType>[argumentType], <DartType>[parameterType]);
expect(result.returnType, returnType);
@@ -2251,7 +2251,7 @@ class FunctionTypeImplTest extends EngineTestCase {
void test_withTypeArguments() {
ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]);
MethodElementImpl methodElement =
- new MethodElementImpl.forNode(AstFactory.identifier3("m"));
+ new MethodElementImpl.forNode(AstTestFactory.identifier3("m"));
enclosingClass.methods = <MethodElement>[methodElement];
FunctionTypeImpl type = new FunctionTypeImpl(methodElement);
DartType expectedType = enclosingClass.typeParameters[0].type;
@@ -3180,7 +3180,7 @@ class InterfaceTypeImplTest extends EngineTestCase {
InterfaceType typeA = classA.type;
ClassElementImpl classB = ElementFactory.classElement2("B");
TypeParameterElementImpl parameterEA =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterType parameterAEType = new TypeParameterTypeImpl(parameterEA);
parameterEA.bound = typeA;
parameterEA.type = parameterAEType;
@@ -3782,14 +3782,14 @@ class InterfaceTypeImplTest extends EngineTestCase {
// implementation.
ClassElementImpl classA = ElementFactory.classElement2("A");
TypeParameterElementImpl parameterElement =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
InterfaceTypeImpl type = new InterfaceTypeImpl(classA);
TypeParameterTypeImpl parameter =
new TypeParameterTypeImpl(parameterElement);
type.typeArguments = <DartType>[parameter];
InterfaceType argumentType = ElementFactory.classElement2("B").type;
TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("F")));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("F")));
InterfaceType result =
type.substitute2(<DartType>[argumentType], <DartType>[parameterType]);
expect(result.element, classA);
@@ -3804,7 +3804,7 @@ class LibraryElementImplTest extends EngineTestCase {
void test_creation() {
expect(
new LibraryElementImpl.forNode(
- createAnalysisContext(), AstFactory.libraryIdentifier2(["l"])),
+ createAnalysisContext(), AstTestFactory.libraryIdentifier2(["l"])),
isNotNull);
}
@@ -3815,9 +3815,9 @@ class LibraryElementImplTest extends EngineTestCase {
LibraryElementImpl library3 = ElementFactory.library(context, "l3");
LibraryElementImpl library4 = ElementFactory.library(context, "l4");
PrefixElement prefixA =
- new PrefixElementImpl.forNode(AstFactory.identifier3("a"));
+ new PrefixElementImpl.forNode(AstTestFactory.identifier3("a"));
PrefixElement prefixB =
- new PrefixElementImpl.forNode(AstFactory.identifier3("b"));
+ new PrefixElementImpl.forNode(AstTestFactory.identifier3("b"));
List<ImportElementImpl> imports = [
ElementFactory.importFor(library2, null),
ElementFactory.importFor(library2, prefixB),
@@ -3836,9 +3836,9 @@ class LibraryElementImplTest extends EngineTestCase {
AnalysisContext context = createAnalysisContext();
LibraryElementImpl library = ElementFactory.library(context, "l1");
PrefixElement prefixA =
- new PrefixElementImpl.forNode(AstFactory.identifier3("a"));
+ new PrefixElementImpl.forNode(AstTestFactory.identifier3("a"));
PrefixElement prefixB =
- new PrefixElementImpl.forNode(AstFactory.identifier3("b"));
+ new PrefixElementImpl.forNode(AstTestFactory.identifier3("b"));
List<ImportElementImpl> imports = [
ElementFactory.importFor(ElementFactory.library(context, "l2"), null),
ElementFactory.importFor(ElementFactory.library(context, "l3"), null),
@@ -3891,7 +3891,7 @@ class LibraryElementImplTest extends EngineTestCase {
void test_setImports() {
AnalysisContext context = createAnalysisContext();
LibraryElementImpl library = new LibraryElementImpl.forNode(
- context, AstFactory.libraryIdentifier2(["l1"]));
+ context, AstTestFactory.libraryIdentifier2(["l1"]));
List<ImportElementImpl> expectedImports = [
ElementFactory.importFor(ElementFactory.library(context, "l2"), null),
ElementFactory.importFor(ElementFactory.library(context, "l3"), null)
@@ -4247,21 +4247,21 @@ main() {
class TypeParameterTypeImplTest extends EngineTestCase {
void test_creation() {
expect(
- new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"))),
+ new TypeParameterTypeImpl(new TypeParameterElementImpl.forNode(
+ AstTestFactory.identifier3("E"))),
isNotNull);
}
void test_getElement() {
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
expect(type.element, element);
}
void test_isMoreSpecificThan_typeArguments_dynamic() {
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
// E << dynamic
expect(type.isMoreSpecificThan(DynamicTypeImpl.instance), isTrue);
@@ -4269,7 +4269,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_isMoreSpecificThan_typeArguments_object() {
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
// E << Object
expect(type.isMoreSpecificThan(ElementFactory.object.type), isTrue);
@@ -4278,11 +4278,11 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_isMoreSpecificThan_typeArguments_recursive() {
ClassElementImpl classS = ElementFactory.classElement2("A");
TypeParameterElementImpl typeParameterU =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("U"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("U"));
TypeParameterTypeImpl typeParameterTypeU =
new TypeParameterTypeImpl(typeParameterU);
TypeParameterElementImpl typeParameterT =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("T"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("T"));
TypeParameterTypeImpl typeParameterTypeT =
new TypeParameterTypeImpl(typeParameterT);
typeParameterT.bound = typeParameterTypeU;
@@ -4294,7 +4294,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_isMoreSpecificThan_typeArguments_self() {
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
// E << E
expect(type.isMoreSpecificThan(type), isTrue);
@@ -4309,7 +4309,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
InterfaceType typeA = classA.type;
InterfaceType typeB = classB.type;
TypeParameterElementImpl typeParameterT =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("T"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("T"));
typeParameterT.bound = typeB;
TypeParameterTypeImpl typeParameterTypeT =
new TypeParameterTypeImpl(typeParameterT);
@@ -4321,12 +4321,12 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() {
ClassElementImpl classS = ElementFactory.classElement2("A");
TypeParameterElementImpl typeParameterU =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("U"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("U"));
typeParameterU.bound = classS.type;
TypeParameterTypeImpl typeParameterTypeU =
new TypeParameterTypeImpl(typeParameterU);
TypeParameterElementImpl typeParameterT =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("T"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("T"));
typeParameterT.bound = typeParameterTypeU;
TypeParameterTypeImpl typeParameterTypeT =
new TypeParameterTypeImpl(typeParameterT);
@@ -4338,7 +4338,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_isMoreSpecificThan_typeArguments_upperBound() {
ClassElementImpl classS = ElementFactory.classElement2("A");
TypeParameterElementImpl typeParameterT =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("T"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("T"));
typeParameterT.bound = classS.type;
TypeParameterTypeImpl typeParameterTypeT =
new TypeParameterTypeImpl(typeParameterT);
@@ -4350,7 +4350,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_resolveToBound_bound() {
ClassElementImpl classS = ElementFactory.classElement2("A");
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
element.bound = classS.type;
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
expect(type.resolveToBound(null), same(classS.type));
@@ -4359,11 +4359,11 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_resolveToBound_nestedBound() {
ClassElementImpl classS = ElementFactory.classElement2("A");
TypeParameterElementImpl elementE =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
elementE.bound = classS.type;
TypeParameterTypeImpl typeE = new TypeParameterTypeImpl(elementE);
TypeParameterElementImpl elementF =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("F"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("F"));
elementF.bound = typeE;
TypeParameterTypeImpl typeF = new TypeParameterTypeImpl(elementE);
expect(typeF.resolveToBound(null), same(classS.type));
@@ -4371,7 +4371,7 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_resolveToBound_unbound() {
TypeParameterTypeImpl type = new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E")));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E")));
// Returns whatever type is passed to resolveToBound().
expect(type.resolveToBound(VoidTypeImpl.instance),
same(VoidTypeImpl.instance));
@@ -4379,10 +4379,10 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_substitute_equal() {
TypeParameterElementImpl element =
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E"));
TypeParameterTypeImpl type = new TypeParameterTypeImpl(element);
InterfaceTypeImpl argument = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("A")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("A")));
TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(element);
expect(type.substitute2(<DartType>[argument], <DartType>[parameter]),
same(argument));
@@ -4390,11 +4390,11 @@ class TypeParameterTypeImplTest extends EngineTestCase {
void test_substitute_notEqual() {
TypeParameterTypeImpl type = new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("E")));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("E")));
InterfaceTypeImpl argument = new InterfaceTypeImpl(
- new ClassElementImpl.forNode(AstFactory.identifier3("A")));
+ new ClassElementImpl.forNode(AstTestFactory.identifier3("A")));
TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(
- new TypeParameterElementImpl.forNode(AstFactory.identifier3("F")));
+ new TypeParameterElementImpl.forNode(AstTestFactory.identifier3("F")));
expect(type.substitute2(<DartType>[argument], <DartType>[parameter]),
same(type));
}
« no previous file with comments | « pkg/analyzer/test/src/dart/constant/utilities_test.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698