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

Unified Diff: tests/isolate/src/PortTest.dart

Issue 10153005: unittest step 3 and 4: remove TestFramework.dart, make test.dart use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « tests/isolate/src/NestedSpawnTest.dart ('k') | tests/isolate/src/RequestReplyTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/src/PortTest.dart
diff --git a/tests/isolate/src/PortTest.dart b/tests/isolate/src/PortTest.dart
index ab8a2dc223a09d7c430dd6da62118905cd647dc3..56563eedb97fac7e15e465b6efb125d5b13fb646 100644
--- a/tests/isolate/src/PortTest.dart
+++ b/tests/isolate/src/PortTest.dart
@@ -2,64 +2,60 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// Dart test program for testing properties of ports.
+// Test properties of ports.
+// Note: unittest.dart depends on ports, in particular on the behaviour tested
+// here. To keep things simple, we don't use the unittest library here.
+
#library("PortTest");
#import("dart:isolate");
-class PortTest {
-
- static void testMain() {
- testHashCode();
- testEquals();
- testMap();
- }
-
- static void testHashCode() {
- ReceivePort rp0 = new ReceivePort();
- ReceivePort rp1 = new ReceivePort();
- Expect.equals(rp0.toSendPort().hashCode(), rp0.toSendPort().hashCode());
- Expect.equals(rp1.toSendPort().hashCode(), rp1.toSendPort().hashCode());
- rp0.close();
- rp1.close();
- }
-
- static void testEquals() {
- ReceivePort rp0 = new ReceivePort();
- ReceivePort rp1 = new ReceivePort();
- Expect.equals(rp0.toSendPort(), rp0.toSendPort());
- Expect.equals(rp1.toSendPort(), rp1.toSendPort());
- Expect.equals(false, (rp0.toSendPort() == rp1.toSendPort()));
- rp0.close();
- rp1.close();
- }
-
- static void testMap() {
- ReceivePort rp0 = new ReceivePort();
- ReceivePort rp1 = new ReceivePort();
- final map = new Map<SendPort, int>();
- map[rp0.toSendPort()] = 42;
- map[rp1.toSendPort()] = 87;
- Expect.equals(42, map[rp0.toSendPort()]);
- Expect.equals(87, map[rp1.toSendPort()]);
- map[rp0.toSendPort()] = 99;
- Expect.equals(99, map[rp0.toSendPort()]);
- Expect.equals(87, map[rp1.toSendPort()]);
+main() {
+ testHashCode();
+ testEquals();
+ testMap();
+}
- map.remove(rp0.toSendPort());
- Expect.equals(false, map.containsKey(rp0.toSendPort()));
- Expect.equals(87, map[rp1.toSendPort()]);
+void testHashCode() {
+ ReceivePort rp0 = new ReceivePort();
+ ReceivePort rp1 = new ReceivePort();
+ Expect.equals(rp0.toSendPort().hashCode(), rp0.toSendPort().hashCode());
+ Expect.equals(rp1.toSendPort().hashCode(), rp1.toSendPort().hashCode());
+ rp0.close();
+ rp1.close();
+}
- map.remove(rp1.toSendPort());
- Expect.equals(false, map.containsKey(rp0.toSendPort()));
- Expect.equals(false, map.containsKey(rp1.toSendPort()));
-
- rp0.close();
- rp1.close();
- }
-
+void testEquals() {
+ ReceivePort rp0 = new ReceivePort();
+ ReceivePort rp1 = new ReceivePort();
+ Expect.equals(rp0.toSendPort(), rp0.toSendPort());
+ Expect.equals(rp1.toSendPort(), rp1.toSendPort());
+ Expect.equals(false, (rp0.toSendPort() == rp1.toSendPort()));
+ rp0.close();
+ rp1.close();
}
-main() {
- PortTest.testMain();
+void testMap() {
+ ReceivePort rp0 = new ReceivePort();
+ ReceivePort rp1 = new ReceivePort();
+ final map = new Map<SendPort, int>();
+ map[rp0.toSendPort()] = 42;
+ map[rp1.toSendPort()] = 87;
+ Expect.equals(42, map[rp0.toSendPort()]);
+ Expect.equals(87, map[rp1.toSendPort()]);
+
+ map[rp0.toSendPort()] = 99;
+ Expect.equals(99, map[rp0.toSendPort()]);
+ Expect.equals(87, map[rp1.toSendPort()]);
+
+ map.remove(rp0.toSendPort());
+ Expect.equals(false, map.containsKey(rp0.toSendPort()));
+ Expect.equals(87, map[rp1.toSendPort()]);
+
+ map.remove(rp1.toSendPort());
+ Expect.equals(false, map.containsKey(rp0.toSendPort()));
+ Expect.equals(false, map.containsKey(rp1.toSendPort()));
+
+ rp0.close();
+ rp1.close();
}
« no previous file with comments | « tests/isolate/src/NestedSpawnTest.dart ('k') | tests/isolate/src/RequestReplyTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698