| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |