| 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 Completer done = new Completer(); | 10 Completer done = new Completer(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 valueToCapture = 499; | 30 valueToCapture = 499; |
| 31 var fun = (x) { | 31 var fun = (x) { |
| 32 Expect.identical(forked, Zone.current); | 32 Expect.identical(forked, Zone.current); |
| 33 return x + 99; | 33 return x + 99; |
| 34 }; | 34 }; |
| 35 var bound = forked.bindUnaryCallback(fun, runGuarded: false); | 35 var bound = forked.bindUnaryCallback(fun, runGuarded: false); |
| 36 Expect.isFalse(identical(fun, bound)); | 36 Expect.isFalse(identical(fun, bound)); |
| 37 | 37 |
| 38 // It is legal to invoke the callback in a different zone. This is, of course, | 38 // It is legal to invoke the callback in a different zone. This is, of course, |
| 39 // etremely discouraged. | 39 // extremely discouraged. |
| 40 var result = bound(399); | 40 var result = bound(399); |
| 41 Expect.equals(498, result); | 41 Expect.equals(498, result); |
| 42 Expect.equals(499, restoredValue); | 42 Expect.equals(499, restoredValue); |
| 43 } | 43 } |
| OLD | NEW |