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

Unified Diff: client/testing/unittest/unittestsuite.dart

Issue 8297009: Get rid of "==" in Expectation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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 | « no previous file | client/tests/client/observable/AbstractObservableTests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/testing/unittest/unittestsuite.dart
diff --git a/client/testing/unittest/unittestsuite.dart b/client/testing/unittest/unittestsuite.dart
index fa79627252fbbe2bd3b11550ef72665a0058ca19..62dac101c0b3dd8055a38759bb83cce54b090a72 100644
--- a/client/testing/unittest/unittestsuite.dart
+++ b/client/testing/unittest/unittestsuite.dart
@@ -299,26 +299,37 @@ class UnitTestSuite {
* Wraps an value and provides an "==" operator that can be used to verify that
* the value matches a given expectation.
*/
-// TODO(rnystrom): Note that because Dart does not currently allow overloading
-// != that this *cannot* be used with !=. If you do expect(1) != 2, it will do
-// the exact wrong thing. (It will invoke == which validates that 1 *does*
-// equal 2.) If we get an overloadable != operator, that can be fixed.
class Expectation {
final _value;
Expectation(this._value);
/** Asserts that the value is equivalent to the given expected value. */
- operator ==(expected) {
+ bool equals(expected) {
Expect.equals(expected, _value);
return _value == expected;
}
+ /** Asserts that the value is null. */
+ void isNull() {
+ Expect.equals(null, _value);
+ }
+
/** Asserts that the value is not null. */
void isNotNull() {
Expect.notEquals(null, _value);
}
+ /** Asserts that the value is true. */
+ void isTrue() {
+ Expect.equals(true, _value);
+ }
+
+ /** Asserts that the value is null. */
+ void isFalse() {
+ Expect.equals(false, _value);
+ }
+
/** Asserts that the value has the same elements as the given collection. */
void equalsCollection(Collection expected) {
Expect.listEquals(expected, _value);
« no previous file with comments | « no previous file | client/tests/client/observable/AbstractObservableTests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698