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

Side by Side Diff: test/stream_channel_test.dart

Issue 1632903004: Add StreamChannelTransformer. (Closed) Base URL: git@github.com:dart-lang/stream_channel.git@master
Patch Set: Code review changes Created 4 years, 11 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
« no previous file with comments | « lib/stream_channel.dart ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 8
9 import 'package:stream_channel/stream_channel.dart'; 9 import 'package:stream_channel/stream_channel.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 26 matching lines...) Expand all
37 expect(otherSinkController.stream.toList(), completion(equals([1, 2, 3]))); 37 expect(otherSinkController.stream.toList(), completion(equals([1, 2, 3])));
38 38
39 otherStreamController.add(4); 39 otherStreamController.add(4);
40 otherStreamController.add(5); 40 otherStreamController.add(5);
41 otherStreamController.add(6); 41 otherStreamController.add(6);
42 otherStreamController.close(); 42 otherStreamController.close();
43 expect(sinkController.stream.toList(), completion(equals([4, 5, 6]))); 43 expect(sinkController.stream.toList(), completion(equals([4, 5, 6])));
44 }); 44 });
45 45
46 test("transform() transforms the channel", () { 46 test("transform() transforms the channel", () {
47 var transformed = channel.transform(UTF8); 47 var transformed = channel.transform(
48 new StreamChannelTransformer.fromCodec(UTF8));
48 49
49 streamController.add([102, 111, 111, 98, 97, 114]); 50 streamController.add([102, 111, 111, 98, 97, 114]);
50 streamController.close(); 51 streamController.close();
51 expect(transformed.stream.toList(), completion(equals(["foobar"]))); 52 expect(transformed.stream.toList(), completion(equals(["foobar"])));
52 53
53 transformed.sink.add("fblthp"); 54 transformed.sink.add("fblthp");
54 transformed.sink.close(); 55 transformed.sink.close();
55 expect(sinkController.stream.toList(), 56 expect(sinkController.stream.toList(),
56 completion(equals([[102, 98, 108, 116, 104, 112]]))); 57 completion(equals([[102, 98, 108, 116, 104, 112]])));
57 }); 58 });
58 } 59 }
OLDNEW
« no previous file with comments | « lib/stream_channel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698