Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: tests/lib/async/stream_event_transform_test.dart

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/async/stream_controller_test.dart ('k') | tests/lib/async/stream_single_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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; 5 library stream_event_transform_test;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 import '../../../pkg/unittest/lib/unittest.dart'; 9 import '../../../pkg/unittest/lib/unittest.dart';
10 import 'event_helper.dart'; 10 import 'event_helper.dart';
11 11
12 void handleData(int data, EventSink<int> sink) { 12 void handleData(int data, EventSink<int> sink) {
13 sink.addError(new AsyncError("$data")); 13 sink.addError("$data");
14 sink.add(data + 1); 14 sink.add(data + 1);
15 } 15 }
16 16
17 void handleError(AsyncError e, EventSink<int> sink) { 17 void handleError(error, EventSink<int> sink) {
18 String value = e.error; 18 String value = error;
19 int data = int.parse(value); 19 int data = int.parse(value);
20 sink.add(data); 20 sink.add(data);
21 sink.addError(new AsyncError("${data + 1}")); 21 sink.addError("${data + 1}");
22 } 22 }
23 23
24 void handleDone(EventSink<int> sink) { 24 void handleDone(EventSink<int> sink) {
25 sink.add(99); 25 sink.add(99);
26 sink.close(); 26 sink.close();
27 } 27 }
28 28
29 class EventTransformer extends StreamEventTransformer<int,int> { 29 class EventTransformer extends StreamEventTransformer<int,int> {
30 void handleData(int data, EventSink<int> sink) { 30 void handleData(int data, EventSink<int> sink) {
31 sink.addError(new AsyncError("$data")); 31 sink.addError("$data");
32 sink.add(data + 1); 32 sink.add(data + 1);
33 } 33 }
34 34
35 void handleError(AsyncError e, EventSink<int> sink) { 35 void handleError(String value, EventSink<int> sink) {
36 String value = e.error;
37 int data = int.parse(value); 36 int data = int.parse(value);
38 sink.add(data); 37 sink.add(data);
39 sink.addError(new AsyncError("${data + 1}")); 38 sink.addError("${data + 1}");
40 } 39 }
41 40
42 void handleDone(EventSink<int> sink) { 41 void handleDone(EventSink<int> sink) {
43 sink.add(99); 42 sink.add(99);
44 sink.close(); 43 sink.close();
45 } 44 }
46 } 45 }
47 46
48 main() { 47 main() {
49 { 48 {
(...skipping 23 matching lines...) Expand all
73 handleData: handleData, 72 handleData: handleData,
74 handleError: handleError, 73 handleError: handleError,
75 handleDone: handleDone 74 handleDone: handleDone
76 ))); 75 )));
77 actual.onDone(() { 76 actual.onDone(() {
78 Expect.listEquals(expected.events, actual.events); 77 Expect.listEquals(expected.events, actual.events);
79 }); 78 });
80 input.replay(c); 79 input.replay(c);
81 } 80 }
82 } 81 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_controller_test.dart ('k') | tests/lib/async/stream_single_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698