OLD | NEW |
| (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 library test; | |
6 | |
7 import 'package:expect/expect.dart'; | |
8 import 'dart:isolate'; | |
9 import "package:async_helper/async_helper.dart"; | |
10 | |
11 funcFoo(x) => x + 2; | |
12 | |
13 foo() { | |
14 stream.single.then((msg) { | |
15 IsolateSink sink = msg; | |
16 sink.add(499); | |
17 sink.close(); | |
18 }); | |
19 } | |
20 | |
21 main() { | |
22 var box = new MessageBox(); | |
23 var snd = streamSpawnFunction(foo); | |
24 var caught_exception = false; | |
25 try { | |
26 snd.add(funcFoo); | |
27 } catch (e) { | |
28 caught_exception = true; | |
29 } | |
30 snd.add(box.sink); | |
31 snd.close(); | |
32 | |
33 asyncStart(); | |
34 box.stream.single.then((msg) { | |
35 Expect.equals(499, msg); | |
36 asyncEnd(); | |
37 }); | |
38 } | |
OLD | NEW |