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

Side by Side Diff: tests/isolate/port_test.dart

Issue 11698002: Fix instance of test for classes that implement call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | tests/language/call_operator_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
regis 2012/12/28 01:42:12 2012
srdjan 2012/12/28 16:11:55 Done.
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test properties of ports. 5 // Test properties of ports.
6 // Note: unittest.dart depends on ports, in particular on the behaviour tested 6 // Note: unittest.dart depends on ports, in particular on the behaviour tested
7 // here. To keep things simple, we don't use the unittest library here. 7 // here. To keep things simple, we don't use the unittest library here.
8 8
9 library PortTest; 9 library PortTest;
10 import 'dart:isolate'; 10 import 'dart:isolate';
11 import '../../pkg/unittest/lib/matcher.dart'; 11 import '../../pkg/unittest/lib/matcher.dart';
12 12
13 main() { 13 main() {
14 testHashCode(); 14 testHashCode();
15 testEquals(); 15 testEquals();
16 testMap(); 16 testMap();
17 } 17 }
18 18
19 void testHashCode() { 19 void testHashCode() {
20 ReceivePort rp0 = new ReceivePort(); 20 ReceivePort rp0 = new ReceivePort();
21 ReceivePort rp1 = new ReceivePort(); 21 ReceivePort rp1 = new ReceivePort();
22 expect(rp0.toSendPort().hashCode, rp0.toSendPort().hashCode); 22 Expect.equals(rp0.toSendPort().hashCode, rp0.toSendPort().hashCode);
23 expect(rp1.toSendPort().hashCode, rp1.toSendPort().hashCode); 23 Expect.equals(rp1.toSendPort().hashCode, rp1.toSendPort().hashCode);
24 rp0.close(); 24 rp0.close();
25 rp1.close(); 25 rp1.close();
26 } 26 }
27 27
28 void testEquals() { 28 void testEquals() {
29 ReceivePort rp0 = new ReceivePort(); 29 ReceivePort rp0 = new ReceivePort();
30 ReceivePort rp1 = new ReceivePort(); 30 ReceivePort rp1 = new ReceivePort();
31 expect(rp0.toSendPort(), rp0.toSendPort()); 31 Expect.equals(rp0.toSendPort(), rp0.toSendPort());
32 expect(rp1.toSendPort(), rp1.toSendPort()); 32 Expect.equals(rp1.toSendPort(), rp1.toSendPort());
33 expect(rp0.toSendPort() == rp1.toSendPort(), isFalse); 33 Expect.isFalse(rp0.toSendPort() == rp1.toSendPort());
34 rp0.close(); 34 rp0.close();
35 rp1.close(); 35 rp1.close();
36 } 36 }
37 37
38 void testMap() { 38 void testMap() {
39 ReceivePort rp0 = new ReceivePort(); 39 ReceivePort rp0 = new ReceivePort();
40 ReceivePort rp1 = new ReceivePort(); 40 ReceivePort rp1 = new ReceivePort();
41 final map = new Map<SendPort, int>(); 41 final map = new Map<SendPort, int>();
42 map[rp0.toSendPort()] = 42; 42 map[rp0.toSendPort()] = 42;
43 map[rp1.toSendPort()] = 87; 43 map[rp1.toSendPort()] = 87;
44 expect(map[rp0.toSendPort()], 42); 44 Expect.equals(map[rp0.toSendPort()], 42);
45 expect(map[rp1.toSendPort()], 87); 45 Expect.equals(map[rp1.toSendPort()], 87);
46 46
47 map[rp0.toSendPort()] = 99; 47 map[rp0.toSendPort()] = 99;
48 expect(map[rp0.toSendPort()], 99); 48 Expect.equals(map[rp0.toSendPort()], 99);
49 expect(map[rp1.toSendPort()], 87); 49 Expect.equals(map[rp1.toSendPort()], 87);
50 50
51 map.remove(rp0.toSendPort()); 51 map.remove(rp0.toSendPort());
52 expect(map.containsKey(rp0.toSendPort()), isFalse); 52 Expect.isFalse(map.containsKey(rp0.toSendPort()));
53 expect(map[rp1.toSendPort()], 87); 53 Expect.equals(map[rp1.toSendPort()], 87);
54 54
55 map.remove(rp1.toSendPort()); 55 map.remove(rp1.toSendPort());
56 expect(map.containsKey(rp0.toSendPort()), isFalse); 56 Expect.isFalse(map.containsKey(rp0.toSendPort()));
57 expect(map.containsKey(rp1.toSendPort()), isFalse); 57 Expect.isFalse(map.containsKey(rp1.toSendPort()));
58 58
59 rp0.close(); 59 rp0.close();
60 rp1.close(); 60 rp1.close();
61 } 61 }
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | tests/language/call_operator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698