Index: client/testing/unittest/shared.dart |
diff --git a/client/testing/unittest/shared.dart b/client/testing/unittest/shared.dart |
index 4f633785614714142337438112251665d409ab61..63a53d9aed6c9a31c22d123aefd80b104f3cc043 100644 |
--- a/client/testing/unittest/shared.dart |
+++ b/client/testing/unittest/shared.dart |
@@ -11,9 +11,9 @@ String _currentGroup = ''; |
/** Tests executed in this suite. */ |
List<TestCase> _tests; |
-/** |
+/** |
* Callback used to run tests. Entrypoints can replace this with their own |
- * if they want. |
+ * if they want. |
*/ |
Function _testRunner; |
@@ -99,7 +99,7 @@ void serialInvokeAsync(List closures) { |
} |
window.setTimeout(invokeNext, 0); |
} |
-} |
+} |
/** |
* Creates a new named group of tests. Calls to group() or test() within the |
@@ -244,7 +244,7 @@ _ensureInitialized() { |
_currentGroup = ''; |
_state = _READY; |
_testRunner = _nextBatch; |
- |
+ |
_platformInitialize(); |
// Immediately queue the suite up. It will run after a timeout (i.e. after |
@@ -263,11 +263,19 @@ class Expectation { |
/** Asserts that the value is equivalent to [expected]. */ |
void equals(expected) { |
+ // Handle strings specially to report better errors. |
if (_value is String && expected is String) { |
Expect.stringEquals(expected, _value); |
- } else { |
- Expect.equals(expected, _value); |
+ return; |
+ } |
+ |
+ // If comparing two maps, see that their keys and values match. |
+ if (_value is Map && expected is Map) { |
+ Expect.mapEquals(expected, _value); |
+ return; |
} |
+ |
Siggi Cherem (dart-lang)
2012/02/10 00:36:51
if (_value is Set ...) ?
Bob Nystrom
2012/02/10 00:44:18
Done.
|
+ Expect.equals(expected, _value); |
} |
/** |
@@ -338,13 +346,13 @@ class TestCase { |
/** Stack trace associated with this test, or null if it succeeded. */ |
String stackTrace; |
- |
+ |
Date startTime; |
- |
+ |
Duration runningTime; |
TestCase(this.id, this.description, this.test, this.callbacks); |
- |
+ |
bool get isComplete() => result != null; |
void pass() { |