| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 handle_error_test; | 5 library handle_error_test; |
| 6 | 6 |
| 7 import "dart:isolate"; | 7 import "dart:isolate"; |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 String error = message[0]; | 85 String error = message[0]; |
| 86 String stack = message[1]; | 86 String stack = message[1]; |
| 87 switch (state2) { | 87 switch (state2) { |
| 88 case 1: | 88 case 1: |
| 89 Expect.equals(new ArgumentError("whoops").toString(), "$error"); | 89 Expect.equals(new ArgumentError("whoops").toString(), "$error"); |
| 90 state2++; | 90 state2++; |
| 91 break; | 91 break; |
| 92 case 2: | 92 case 2: |
| 93 Expect.equals(new RangeError.value(37).toString(), "$error"); | 93 Expect.equals(new RangeError.value(37).toString(), "$error"); |
| 94 state2++; | 94 state2++; |
| 95 reply.close(); | 95 reply2.close(); |
| 96 isolate2.removeErrorListener(errorPort2.sendPort); | 96 isolate2.removeErrorListener(errorPort2.sendPort); |
| 97 errorPort2.close(); | 97 errorPort2.close(); |
| 98 asyncEnd(); | 98 asyncEnd(); |
| 99 break; | 99 break; |
| 100 default: | 100 default: |
| 101 throw "Bad state-2 for error: $state: $error"; | 101 throw "Bad state-2 for error: $state: $error"; |
| 102 } | 102 } |
| 103 }; | 103 }; |
| 104 isolate2.addErrorListener(errorPort2.sendPort); | 104 isolate2.addErrorListener(errorPort2.sendPort); |
| 105 | 105 |
| 106 sendPort1.send(0); | 106 sendPort1.send(0); |
| 107 sendPort2.send(0); | 107 sendPort2.send(0); |
| 108 sendPort1.send(1); | 108 sendPort1.send(1); |
| 109 sendPort2.send(1); | 109 sendPort2.send(1); |
| 110 sendPort1.send(2); | 110 sendPort1.send(2); |
| 111 sendPort2.send(2); | 111 sendPort2.send(2); |
| 112 sendPort1.send(3); | 112 sendPort1.send(3); |
| 113 sendPort2.send(3); | 113 sendPort2.send(3); |
| 114 }); | 114 }); |
| 115 } | 115 } |
| 116 | 116 |
| OLD | NEW |