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

Side by Side Diff: tests/lib_strong/convert/streamed_conversion_json_decode1_test.dart

Issue 2989993002: fix unsound cast failures in tests (Closed)
Patch Set: fix Created 3 years, 4 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
OLDNEW
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:convert';
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 9
10 final TESTS = [ 10 final TESTS = [
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!isJsonEqual(o1[key], o2[key])) return false; 76 if (!isJsonEqual(o1[key], o2[key])) return false;
77 } 77 }
78 return true; 78 return true;
79 } 79 }
80 return false; 80 return false;
81 } 81 }
82 82
83 Stream<Object> createStream(List<String> chunks) { 83 Stream<Object> createStream(List<String> chunks) {
84 var decoder = new JsonDecoder(null); 84 var decoder = new JsonDecoder(null);
85 var controller; 85 var controller;
86 controller = new StreamController(onListen: () { 86 controller = new StreamController<String>(onListen: () {
87 chunks.forEach(controller.add); 87 chunks.forEach(controller.add);
88 controller.close(); 88 controller.close();
89 }); 89 });
90 return controller.stream.transform(decoder); 90 return controller.stream.transform(decoder);
91 } 91 }
92 92
93 Stream<Object> decode(String str) { 93 Stream<Object> decode(String str) {
94 return createStream([str]); 94 return createStream([str]);
95 } 95 }
96 96
(...skipping 23 matching lines...) Expand all
120 [object, longString] 120 [object, longString]
121 ]; 121 ];
122 }); 122 });
123 for (var test in TESTS) { 123 for (var test in TESTS) {
124 var o = test[0]; 124 var o = test[0];
125 var string = test[1]; 125 var string = test[1];
126 checkIsJsonEqual(o, decode(string)); 126 checkIsJsonEqual(o, decode(string));
127 checkIsJsonEqual(o, decode2(string)); 127 checkIsJsonEqual(o, decode2(string));
128 } 128 }
129 } 129 }
OLDNEW
« no previous file with comments | « tests/lib_strong/convert/chunked_conversion_utf87_test.dart ('k') | tests/lib_strong/convert/unicode_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698