| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 library test; |
| 6 |
| 5 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 6 | 8 |
| 7 funcFoo(x) => x + 2; | 9 funcFoo(x) => x + 2; |
| 8 | 10 |
| 9 foo() { | 11 foo() { |
| 10 stream.single.then((msg) { | 12 stream.single.then((msg) { |
| 11 IsolateSink sink = msg; | 13 IsolateSink sink = msg; |
| 12 sink.add(499); | 14 sink.add(499); |
| 13 sink.close(); | 15 sink.close(); |
| 14 }); | 16 }); |
| 15 } | 17 } |
| 16 | 18 |
| 17 main() { | 19 main() { |
| 18 var box = new MessageBox(); | 20 var box = new MessageBox(); |
| 19 var snd = streamSpawnFunction(foo); | 21 var snd = streamSpawnFunction(foo); |
| 20 var caught_exception = false; | 22 var caught_exception = false; |
| 21 try { | 23 try { |
| 22 snd.add(funcFoo); | 24 snd.add(funcFoo); |
| 23 } catch (e) { | 25 } catch (e) { |
| 24 caught_exception = true; | 26 caught_exception = true; |
| 25 } | 27 } |
| 26 snd.add(box.sink); | 28 snd.add(box.sink); |
| 27 snd.close(); | 29 snd.close(); |
| 28 | 30 |
| 29 box.stream.single.then((msg) { | 31 box.stream.single.then((msg) { |
| 30 Expect.equals(499, msg); | 32 Expect.equals(499, msg); |
| 31 }); | 33 }); |
| 32 } | 34 } |
| OLD | NEW |