| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 stream_event_transform_test; |
| 6 |
| 5 import 'dart:async'; | 7 import 'dart:async'; |
| 6 import '../../../pkg/unittest/lib/unittest.dart'; | 8 import '../../../pkg/unittest/lib/unittest.dart'; |
| 7 import 'event_helper.dart'; | 9 import 'event_helper.dart'; |
| 8 | 10 |
| 9 void handleData(int data, StreamSink<int> sink) { | 11 void handleData(int data, StreamSink<int> sink) { |
| 10 sink.signalError(new AsyncError("$data")); | 12 sink.signalError(new AsyncError("$data")); |
| 11 sink.add(data + 1); | 13 sink.add(data + 1); |
| 12 } | 14 } |
| 15 |
| 13 void handleError(AsyncError e, StreamSink<int> sink) { | 16 void handleError(AsyncError e, StreamSink<int> sink) { |
| 14 String value = e.error; | 17 String value = e.error; |
| 15 int data = int.parse(value); | 18 int data = int.parse(value); |
| 16 sink.add(data); | 19 sink.add(data); |
| 17 sink.signalError(new AsyncError("${data + 1}")); | 20 sink.signalError(new AsyncError("${data + 1}")); |
| 18 } | 21 } |
| 19 | 22 |
| 20 void handleDone(StreamSink<int> sink) { | 23 void handleDone(StreamSink<int> sink) { |
| 21 sink.add(99); | 24 sink.add(99); |
| 22 sink.close(); | 25 sink.close(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 handleData: handleData, | 71 handleData: handleData, |
| 69 handleError: handleError, | 72 handleError: handleError, |
| 70 handleDone: handleDone | 73 handleDone: handleDone |
| 71 ))); | 74 ))); |
| 72 actual.onDone(() { | 75 actual.onDone(() { |
| 73 Expect.listEquals(expected.events, actual.events); | 76 Expect.listEquals(expected.events, actual.events); |
| 74 }); | 77 }); |
| 75 input.replay(c); | 78 input.replay(c); |
| 76 } | 79 } |
| 77 } | 80 } |
| OLD | NEW |