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

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

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: fix Created 3 years, 9 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Disable background compilation so that the Issue 24908 can be reproduced. 4 // Disable background compilation so that the Issue 24908 can be reproduced.
5 // VMOptions=--no-background-compilation 5 // VMOptions=--no-background-compilation
6 6
7 library json_test; 7 library json_test;
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 import "dart:convert"; 10 import "dart:convert";
(...skipping 20 matching lines...) Expand all
31 Expect.isTrue(expected.compareTo(actual) == 0, 31 Expect.isTrue(expected.compareTo(actual) == 0,
32 "$path: Expected: $expected, was: $actual"); 32 "$path: Expected: $expected, was: $actual");
33 } else { 33 } else {
34 // String, bool, null. 34 // String, bool, null.
35 Expect.equals(expected, actual, path); 35 Expect.equals(expected, actual, path);
36 } 36 }
37 } 37 }
38 for (var reviver in [null, (k, v) => v]) { 38 for (var reviver in [null, (k, v) => v]) {
39 for (var split in [0, 1, 2, 3]) { 39 for (var split in [0, 1, 2, 3]) {
40 var name = (reviver == null) ? "" : "reviver:"; 40 var name = (reviver == null) ? "" : "reviver:";
41 var sink = new ChunkedConversionSink.withCallback((values) { 41 var sink = new ChunkedConversionSink<dynamic>.withCallback((values) {
42 var value = values[0]; 42 var value = values[0];
43 compare(expected, value, "$name$value"); 43 compare(expected, value, "$name$value");
44 }); 44 });
45 var decoderSink = JSON.decoder.startChunkedConversion(sink); 45 var decoderSink = JSON.decoder.startChunkedConversion(sink);
46 switch (split) { 46 switch (split) {
47 case 0: 47 case 0:
48 // Split after first char. 48 // Split after first char.
49 decoderSink.add(json.substring(0, 1)); 49 decoderSink.add(json.substring(0, 1));
50 decoderSink.add(json.substring(1)); 50 decoderSink.add(json.substring(1));
51 decoderSink.close(); 51 decoderSink.close();
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 319 }
320 320
321 main() { 321 main() {
322 testNumbers(); 322 testNumbers();
323 testStrings(); 323 testStrings();
324 testWords(); 324 testWords();
325 testObjects(); 325 testObjects();
326 testArrays(); 326 testArrays();
327 testWhitespace(); 327 testWhitespace();
328 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698