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

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

Issue 9369006: First prototype of import map generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review and add unit tests. Created 8 years, 10 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/testing/unittest/unittest_vm.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/testing/unittest/shared.dart
diff --git a/client/testing/unittest/shared.dart b/client/testing/unittest/shared.dart
index c6faa4aec568a3a12b4015a75b5c607077e22458..7a2ac82f0eab9fc44bc73ff6eed3f34e3e1fd151 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,6 +263,28 @@ class Expectation {
/** Asserts that the value is equivalent to [expected]. */
void equals(expected) {
+ // If comparing two maps, see that their keys and values match.
Siggi Cherem (dart-lang) 2012/02/09 02:18:23 seems like you are not synced up to latest! (my ch
Bob Nystrom 2012/02/10 00:31:47 Done.
+ if (_value is Map && expected is Map) {
Siggi Cherem (dart-lang) 2012/02/09 02:18:23 Let's add this as mapEquals in corelib/src/expect.
Bob Nystrom 2012/02/10 00:31:47 Done.
+ // Make sure all of the values are present in both and match.
+ for (final key in expected.getKeys()) {
+ if (!_value.containsKey(key)) {
+ Expect.fail("Expect map to contain key '$key'.");
+ }
+
+ Expect.equals(expected[key], _value[key]);
+ }
+
+ // Make sure the actual map doesn't have any extra keys.
+ for (final key in _value.getKeys()) {
+ if (!expected.containsKey(key)) {
+ Expect.fail("Actual map contains unexpected key '$key'.");
+ }
+ }
+
+ // If we got here, they are equal.
+ return;
+ }
+
Expect.equals(expected, _value);
}
@@ -334,13 +356,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() {
« no previous file with comments | « no previous file | client/testing/unittest/unittest_vm.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698