OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
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 // This is the original dart program that was used to generate the snapshot | 5 // This is the original dart program that was used to generate the snapshot |
6 // in file issue14236_test.dart | 6 // in file issue14236_test.dart |
7 // The original test/main has been commented out and we have a test/main which | 7 // The original test/main has been commented out and we have a test/main which |
8 // throws an error to ensure that this file is not executed as part of the | 8 // throws an error to ensure that this file is not executed as part of the |
9 // test. | 9 // test. |
10 | 10 |
11 library test.issue14236; | 11 library test.issue14236; |
12 import 'dart:isolate'; | 12 import 'dart:isolate'; |
13 import "package:expect/expect.dart"; | 13 import "package:expect/expect.dart"; |
14 | 14 |
15 /* | 15 /* |
16 test() { | 16 test(SendPort replyTo) { |
17 port.receive((msg, reply) => reply.send(msg)); | 17 replyTo.send("from Isolate"); |
18 } | 18 } |
19 | 19 |
20 main() { | 20 main() { |
| 21 asyncStart(); |
21 ReceivePort port = new ReceivePort(); | 22 ReceivePort port = new ReceivePort(); |
22 port.receive((msg, reply) => port.close()); | 23 Isolate.spawn(test, port.sendPort); |
23 | 24 port.first.then((msg) { |
24 SendPort s = spawnFunction(test); | 25 Expect.equals("from Isolate", msg); |
25 s.send('hi', port.toSendPort()); | 26 asyncEnd(); |
| 27 }); |
26 } | 28 } |
27 */ | 29 */ |
28 | 30 |
29 test() { | 31 test() { |
30 Expect.fail("Don't expect this to run at all"); | 32 Expect.fail("Don't expect this to run at all"); |
31 } | 33 } |
32 main() { | 34 main() { |
33 Expect.fail("Don't expect this to run at all"); | 35 Expect.fail("Don't expect this to run at all"); |
34 } | 36 } |
OLD | NEW |