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

Side by Side Diff: test/codegen/expect/lib/convert/chunked_conversion_json_decode1_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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
(Empty)
1 dart_library.library('lib/convert/chunked_conversion_json_decode1_test', null, / * Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__chunked_conversion_json_decode1_test(exports, dart_sdk, expect ) {
5 'use strict';
6 const core = dart_sdk.core;
7 const _interceptors = dart_sdk._interceptors;
8 const convert = dart_sdk.convert;
9 const dart = dart_sdk.dart;
10 const dartx = dart_sdk.dartx;
11 const expect$ = expect.expect;
12 const chunked_conversion_json_decode1_test = Object.create(null);
13 let JSArrayOfObject = () => (JSArrayOfObject = dart.constFn(_interceptors.JSAr ray$(core.Object)))();
14 let JSArrayOfList = () => (JSArrayOfList = dart.constFn(_interceptors.JSArray$ (core.List)))();
15 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c ore.int)))();
16 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
17 let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptor s.JSArray$(ListOfint())))();
18 let ListOfObject = () => (ListOfObject = dart.constFn(core.List$(core.Object)) )();
19 let JSArrayOfListOfObject = () => (JSArrayOfListOfObject = dart.constFn(_inter ceptors.JSArray$(ListOfObject())))();
20 let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(da rt.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic])))();
21 let ListTovoid = () => (ListTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [core.List])))();
22 let StringToObject = () => (StringToObject = dart.constFn(dart.definiteFunctio nType(core.Object, [core.String])))();
23 let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart .void, [core.int])))();
24 let ListOfObjectToIterable = () => (ListOfObjectToIterable = dart.constFn(dart .definiteFunctionType(core.Iterable, [ListOfObject()])))();
25 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
26 dart.defineLazy(chunked_conversion_json_decode1_test, {
27 get TESTS() {
28 return JSArrayOfListOfObject().of([JSArrayOfObject().of([5, '5']), JSArray OfObject().of([-42, '-42']), JSArrayOfObject().of([3.14, '3.14']), JSArrayOfObje ct().of([true, 'true']), JSArrayOfObject().of([false, 'false']), JSArrayOfObject ().of([null, 'null']), JSArrayOfObject().of(['quote"or\'', '"quote\\"or\'"']), J SArrayOfObject().of(['', '""']), JSArrayOfObject().of([[], "[]"]), JSArrayOfObje ct().of([JSArrayOfObject().of([3, -4.5, true, "hi", false]), '[3,-4.5,true,"hi", false]']), JSArrayOfObject().of([[null], "[null]"]), JSArrayOfObject().of([JSArr ayOfList().of([[null]]), "[[null]]"]), JSArrayOfObject().of([JSArrayOfListOfint( ).of([JSArrayOfint().of([3])]), "[[3]]"]), JSArrayOfObject().of([dart.map(), "{} "]), JSArrayOfObject().of([dart.map({x: 3, y: 4.5, z: "hi", u: true, v: false}), '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}']), JSArrayOfObject().of([dart.map ({x: null}), '{"x":null}']), JSArrayOfObject().of([dart.map({x: dart.map()}), '{ "x":{}}']), JSArrayOfObject().of([dart.map({"hi there": 499, "'": -0.0}), '{"hi there":499,"\'":-0.0}']), JSArrayOfObject().of(['\\foo', '"\\\\foo"'])]);
29 }
30 });
31 chunked_conversion_json_decode1_test.isJsonEqual = function(o1, o2) {
32 if (dart.equals(o1, o2)) return true;
33 if (core.List.is(o1) && core.List.is(o2)) {
34 if (o1[dartx.length] != o2[dartx.length]) return false;
35 for (let i = 0; i < dart.notNull(o1[dartx.length]); i++) {
36 if (!dart.test(chunked_conversion_json_decode1_test.isJsonEqual(o1[dartx .get](i), o2[dartx.get](i)))) return false;
37 }
38 return true;
39 }
40 if (core.Map.is(o1) && core.Map.is(o2)) {
41 if (o1[dartx.length] != o2[dartx.length]) return false;
42 for (let key of o1[dartx.keys]) {
43 expect$.Expect.isTrue(typeof key == 'string');
44 if (!dart.test(o2[dartx.containsKey](key))) return false;
45 if (!dart.test(chunked_conversion_json_decode1_test.isJsonEqual(o1[dartx .get](key), o2[dartx.get](key)))) return false;
46 }
47 return true;
48 }
49 return false;
50 };
51 dart.fn(chunked_conversion_json_decode1_test.isJsonEqual, dynamicAnddynamicTob ool());
52 chunked_conversion_json_decode1_test.decode = function(str) {
53 let result = null;
54 let decoder = new convert.JsonDecoder(null);
55 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
56 let stringConversionSink = decoder.startChunkedConversion(objectSink);
57 stringConversionSink.add(str);
58 stringConversionSink.close();
59 return result;
60 };
61 dart.fn(chunked_conversion_json_decode1_test.decode, StringToObject());
62 chunked_conversion_json_decode1_test.decode2 = function(str) {
63 let result = null;
64 let decoder = new convert.JsonDecoder(null);
65 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
66 let stringConversionSink = decoder.startChunkedConversion(objectSink);
67 let stringSink = stringConversionSink.asStringSink();
68 stringSink.write(str);
69 stringSink.close();
70 return result;
71 };
72 dart.fn(chunked_conversion_json_decode1_test.decode2, StringToObject());
73 chunked_conversion_json_decode1_test.decode3 = function(str) {
74 let result = null;
75 let decoder = new convert.JsonDecoder(null);
76 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
77 let stringConversionSink = decoder.startChunkedConversion(objectSink);
78 let stringSink = stringConversionSink.asStringSink();
79 str[dartx.codeUnits][dartx.forEach](dart.bind(stringSink, 'writeCharCode'));
80 stringSink.close();
81 return result;
82 };
83 dart.fn(chunked_conversion_json_decode1_test.decode3, StringToObject());
84 chunked_conversion_json_decode1_test.decode4 = function(str) {
85 let result = null;
86 let decoder = new convert.JsonDecoder(null);
87 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
88 let stringConversionSink = decoder.startChunkedConversion(objectSink);
89 let stringSink = stringConversionSink.asStringSink();
90 str[dartx.runes].forEach(dart.bind(stringSink, 'writeCharCode'));
91 stringSink.close();
92 return result;
93 };
94 dart.fn(chunked_conversion_json_decode1_test.decode4, StringToObject());
95 chunked_conversion_json_decode1_test.decode5 = function(str) {
96 let result = null;
97 let decoder = new convert.JsonDecoder(null);
98 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
99 let stringConversionSink = decoder.startChunkedConversion(objectSink);
100 let inputByteSink = stringConversionSink.asUtf8Sink(false);
101 let tmpBytes = convert.UTF8.encode(str);
102 inputByteSink.add(ListOfint()._check(tmpBytes));
103 inputByteSink.close();
104 return result;
105 };
106 dart.fn(chunked_conversion_json_decode1_test.decode5, StringToObject());
107 chunked_conversion_json_decode1_test.decode6 = function(str) {
108 let result = null;
109 let decoder = new convert.JsonDecoder(null);
110 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
111 let stringConversionSink = decoder.startChunkedConversion(objectSink);
112 let inputByteSink = stringConversionSink.asUtf8Sink(false);
113 let tmpBytes = convert.UTF8.encode(str);
114 tmpBytes[dartx.forEach](dart.fn(b => inputByteSink.addSlice(JSArrayOfint().o f([0, b, 1]), 1, 2, false), intTovoid()));
115 inputByteSink.close();
116 return result;
117 };
118 dart.fn(chunked_conversion_json_decode1_test.decode6, StringToObject());
119 chunked_conversion_json_decode1_test.decode7 = function(str) {
120 let result = null;
121 let decoder = new convert.JsonDecoder(null);
122 let objectSink = convert.ChunkedConversionSink.withCallback(dart.fn(x => res ult = x[dartx.single], ListTovoid()));
123 let stringConversionSink = decoder.startChunkedConversion(objectSink);
124 stringConversionSink.addSlice("1" + dart.notNull(str) + "2", 1, dart.notNull (str[dartx.length]) + 1, false);
125 stringConversionSink.close();
126 return result;
127 };
128 dart.fn(chunked_conversion_json_decode1_test.decode7, StringToObject());
129 chunked_conversion_json_decode1_test.main = function() {
130 let tests = chunked_conversion_json_decode1_test.TESTS[dartx.expand](dart.dy namic)(dart.fn(test => {
131 let object = test[dartx.get](0);
132 let string = test[dartx.get](1);
133 let longString = " " + " " + dart.str`${stri ng}` + " " + " ";
134 return JSArrayOfListOfObject().of([test, JSArrayOfObject().of([object, lon gString])]);
135 }, ListOfObjectToIterable()));
136 for (let test of chunked_conversion_json_decode1_test.TESTS) {
137 let o = test[dartx.get](0);
138 let string = test[dartx.get](1);
139 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode(core.String._check(string))));
140 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode2(core.String._check(string))));
141 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode3(core.String._check(string))));
142 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode4(core.String._check(string))));
143 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode5(core.String._check(string))));
144 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode6(core.String._check(string))));
145 expect$.Expect.isTrue(chunked_conversion_json_decode1_test.isJsonEqual(o, chunked_conversion_json_decode1_test.decode7(core.String._check(string))));
146 }
147 };
148 dart.fn(chunked_conversion_json_decode1_test.main, VoidTodynamic());
149 // Exports:
150 exports.chunked_conversion_json_decode1_test = chunked_conversion_json_decode1 _test;
151 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698