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

Unified Diff: pkg/analyzer/test/utils.dart

Issue 2623283002: Replace same() with equals() in TypeAssertions. (Closed)
Patch Set: Created 3 years, 11 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/test/generated/strong_mode_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/utils.dart
diff --git a/pkg/analyzer/test/utils.dart b/pkg/analyzer/test/utils.dart
index a8ed5e7c5af271a5e792d678da4fb04af9567b3d..6d70357280673cd487f00fe20b1759a01c3e24be 100644
--- a/pkg/analyzer/test/utils.dart
+++ b/pkg/analyzer/test/utils.dart
@@ -221,12 +221,12 @@ class TypeAssertions {
/**
* Primitive assertion for the list type
*/
- Asserter<DartType> get isList => sameElement(_typeProvider.listType);
+ Asserter<DartType> get isList => hasElementOf(_typeProvider.listType);
/**
* Primitive assertion for the map type
*/
- Asserter<DartType> get isMap => sameElement(_typeProvider.mapType);
+ Asserter<DartType> get isMap => hasElementOf(_typeProvider.mapType);
/**
* Primitive assertion for the num type
@@ -239,10 +239,16 @@ class TypeAssertions {
Asserter<DartType> get isString => isType(_typeProvider.stringType);
/**
- * Given a type, produce an assertion that a type has the same element.
+ * Assert that a type has the element that is equal to the [expected].
*/
- Asserter<DartType> hasElement(Element element) =>
- (DartType type) => expect(element, same(type.element));
+ Asserter<DartType> hasElement(Element expected) =>
+ (DartType type) => expect(expected, type.element);
+
+ /**
+ * Assert that a type has the element that is equal to the element of the
+ * given [type].
+ */
+ Asserter<DartType> hasElementOf(DartType type) => hasElement(type.element);
/**
* Given assertions for the argument and return types, produce an
@@ -258,7 +264,7 @@ class TypeAssertions {
/**
* Given an assertion for the base type and assertions over the type
- * parameters, produce an assertion over instantations.
+ * parameters, produce an assertion over instantiations.
*/
AsserterBuilder<List<Asserter<DartType>>, DartType> isInstantiationOf(
Asserter<DartType> baseAssert) =>
@@ -288,15 +294,9 @@ class TypeAssertions {
isInstantiationOf(isMap)([argAssert0, argAssert1]);
/**
- * Assert that one type is the same as another
+ * Assert that a type is equal to the [expected].
*/
- Asserter<DartType> isType(DartType argument) => (DartType t) {
- expect(t, same(argument));
+ Asserter<DartType> isType(DartType expected) => (DartType t) {
+ expect(t, expected);
};
-
- /**
- * Given a type, produce an assertion that a type has the same element.
- */
- Asserter<DartType> sameElement(DartType elementType) =>
- hasElement(elementType.element);
}
« no previous file with comments | « pkg/analyzer/test/generated/strong_mode_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698