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

Side by Side Diff: tests/isolate/src/APIv2_unresolvedPortsStandaloneNegativeTest.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, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 // A negative test to ensure we are covering all the assertions and running to
6 // completion APIv2_unresolvedPortsStandaloneTest.
7 #library('unresolved_ports');
8 #import('dart:isolate');
9
10 bethIsolate() {
11 port.receive((msg, reply) => msg[1].send(
12 '${msg[0]}\nBeth says: Tim are you coming? And Bob?', reply));
13 }
14
15 timIsolate() {
16 SendPort bob = spawnFunction(bobIsolate);
17 port.receive((msg, reply) => bob.send(
18 '$msg\nTim says: Can you tell "main" that we are all coming?', reply));
19 }
20
21 bobIsolate() {
22 port.receive((msg, reply) => reply.send(
23 '$msg\nBob says: we are all coming!'));
24 }
25
26 main() {
27 ReceivePort port = new ReceivePort();
28 port.receive((msg, _) {
29 Expect.equals('main says: Beth, find out if Tim is coming.'
30 + '\nBeth says: Tim are you coming? And Bob?'
31 + '\nTim says: Can you tell "main" that we are all coming?'
32 + '\nBob says: we are NOT coming!', msg); // should be 'all', not 'NOT'
33 port.close();
34 });
35
36 SendPort tim = spawnFunction(timIsolate);
37 SendPort beth = spawnFunction(bethIsolate);
38
39 beth.send(
40 // because tim is created asynchronously, here we are sending an
41 // unresolved port:
42 ['main says: Beth, find out if Tim is coming.', tim],
43 port.toSendPort());
44 }
OLDNEW
« no previous file with comments | « tests/isolate/src/APIv2_unresolvedPortsNegativeTest.dart ('k') | tests/isolate/src/APIv2_unresolvedPortsStandaloneTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698