| 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:convert'; | 6 import 'dart:convert'; |
| 7 | 7 |
| 8 final TESTS = [ | 8 final TESTS = [ |
| 9 [ 5, '5' ], | 9 [ 5, '5' ], |
| 10 [ -42, '-42' ], | 10 [ -42, '-42' ], |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return result; | 111 return result; |
| 112 } | 112 } |
| 113 | 113 |
| 114 Object decode6(String str) { | 114 Object decode6(String str) { |
| 115 Object result; | 115 Object result; |
| 116 var decoder = new JsonDecoder(null); | 116 var decoder = new JsonDecoder(null); |
| 117 ChunkedConversionSink objectSink = | 117 ChunkedConversionSink objectSink = |
| 118 new ChunkedConversionSink.withCallback((x) => result = x.single); | 118 new ChunkedConversionSink.withCallback((x) => result = x.single); |
| 119 var stringConversionSink = decoder.startChunkedConversion(objectSink); | 119 var stringConversionSink = decoder.startChunkedConversion(objectSink); |
| 120 ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); | 120 ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); |
| 121 Object tmpBytes = UTF8.encode(str); | 121 var tmpBytes = UTF8.encode(str); |
| 122 tmpBytes.forEach((b) => inputByteSink.addSlice([0, b, 1], 1, 2, false)); | 122 tmpBytes.forEach((b) => inputByteSink.addSlice([0, b, 1], 1, 2, false)); |
| 123 inputByteSink.close(); | 123 inputByteSink.close(); |
| 124 return result; | 124 return result; |
| 125 } | 125 } |
| 126 | 126 |
| 127 Object decode7(String str) { | 127 Object decode7(String str) { |
| 128 Object result; | 128 Object result; |
| 129 var decoder = new JsonDecoder(null); | 129 var decoder = new JsonDecoder(null); |
| 130 ChunkedConversionSink objectSink = | 130 ChunkedConversionSink objectSink = |
| 131 new ChunkedConversionSink.withCallback((x) => result = x.single); | 131 new ChunkedConversionSink.withCallback((x) => result = x.single); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 152 var string = test[1]; | 152 var string = test[1]; |
| 153 Expect.isTrue(isJsonEqual(o, decode(string))); | 153 Expect.isTrue(isJsonEqual(o, decode(string))); |
| 154 Expect.isTrue(isJsonEqual(o, decode2(string))); | 154 Expect.isTrue(isJsonEqual(o, decode2(string))); |
| 155 Expect.isTrue(isJsonEqual(o, decode3(string))); | 155 Expect.isTrue(isJsonEqual(o, decode3(string))); |
| 156 Expect.isTrue(isJsonEqual(o, decode4(string))); | 156 Expect.isTrue(isJsonEqual(o, decode4(string))); |
| 157 Expect.isTrue(isJsonEqual(o, decode5(string))); | 157 Expect.isTrue(isJsonEqual(o, decode5(string))); |
| 158 Expect.isTrue(isJsonEqual(o, decode6(string))); | 158 Expect.isTrue(isJsonEqual(o, decode6(string))); |
| 159 Expect.isTrue(isJsonEqual(o, decode7(string))); | 159 Expect.isTrue(isJsonEqual(o, decode7(string))); |
| 160 } | 160 } |
| 161 } | 161 } |
| OLD | NEW |