| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test; | 5 library test; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:convert"; | 8 import "dart:convert"; |
| 9 import "unicode_tests.dart" show UNICODE_TESTS; | 9 import "unicode_tests.dart" show UNICODE_TESTS; |
| 10 | 10 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 sink.add(codes.sublist(i, j)); | 229 sink.add(codes.sublist(i, j)); |
| 230 sink.add(codes.sublist(j)); | 230 sink.add(codes.sublist(j)); |
| 231 sink.close(); | 231 sink.close(); |
| 232 }); | 232 }); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Test that `codeString.codeUnits` fails to parse as UTF-8 JSON, | 237 // Test that `codeString.codeUnits` fails to parse as UTF-8 JSON, |
| 238 // even with decoder not throwing on malformed encodings. | 238 // even with decoder not throwing on malformed encodings. |
| 239 void jsonThrows(Strig name, String codeString) { | 239 void jsonThrows(String name, String codeString) { |
| 240 testJsonThrows(tag, action) { | 240 testJsonThrows(tag, action) { |
| 241 // Not allowing malformed, expect throw. | 241 // Not allowing malformed, expect throw. |
| 242 var sink = new ChunkedConversionSink.withCallback((values) { | 242 var sink = new ChunkedConversionSink.withCallback((values) { |
| 243 Expect.unreachable(tag); | 243 Expect.unreachable(tag); |
| 244 }); | 244 }); |
| 245 var decoderSink = JSON.decoder.startChunkedConversion(sink) | 245 var decoderSink = JSON.decoder.startChunkedConversion(sink) |
| 246 .asUtf8Sink(true); | 246 .asUtf8Sink(true); |
| 247 Expect.throws(() { action(decoderSink); }, null, tag); | 247 Expect.throws(() { action(decoderSink); }, null, tag); |
| 248 } | 248 } |
| 249 | 249 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 sink.add(bytes.sublist(0, i)); | 441 sink.add(bytes.sublist(0, i)); |
| 442 sink.add(bytes.sublist(i, j)); | 442 sink.add(bytes.sublist(i, j)); |
| 443 sink.add(bytes.sublist(j)); | 443 sink.add(bytes.sublist(j)); |
| 444 sink.add([0x22]); | 444 sink.add([0x22]); |
| 445 sink.close(); | 445 sink.close(); |
| 446 }); | 446 }); |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 } | 450 } |
| OLD | NEW |