OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:convert'; |
7 import 'dart:io'; | 8 import 'dart:io'; |
8 import 'dart:isolate'; | 9 import 'dart:isolate'; |
9 | 10 |
10 void testZLibInflate_regress10026() { | 11 void testZLibInflate_regress10026() { |
11 test(data, expect) { | 12 test(data, expect) { |
12 var port = new ReceivePort(); | 13 var port = new ReceivePort(); |
13 var controller = new StreamController(sync: true); | 14 var controller = new StreamController(sync: true); |
14 controller.stream | 15 controller.stream |
15 .transform(ZLIB.decoder) | 16 .transform(ZLIB.decoder) |
16 .transform(new StringDecoder()) | 17 .transform(UTF8.decoder) |
17 .fold(new StringBuffer(), (buffer, s) { | 18 .fold(new StringBuffer(), (buffer, s) { |
18 buffer.write(s); | 19 buffer.write(s); |
19 return buffer; | 20 return buffer; |
20 }) | 21 }) |
21 .then((out) { | 22 .then((out) { |
22 Expect.equals(out.toString(), expect); | 23 Expect.equals(out.toString(), expect); |
23 port.close(); | 24 port.close(); |
24 }); | 25 }); |
25 controller.add(data); | 26 controller.add(data); |
26 controller.close(); | 27 controller.close(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 </div> | 131 </div> |
131 </body> | 132 </body> |
132 </html> | 133 </html> |
133 '''); | 134 '''); |
134 } | 135 } |
135 | 136 |
136 void main() { | 137 void main() { |
137 testZLibInflate_regress10026(); | 138 testZLibInflate_regress10026(); |
138 } | 139 } |
139 | 140 |
OLD | NEW |