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

Side by Side Diff: test/codegen/expect/language/compile_time_constant_b_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('language/compile_time_constant_b_test', null, /* Imports * /[
2 'dart_sdk',
3 'expect'
4 ], function load__compile_time_constant_b_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const _interceptors = dart_sdk._interceptors;
8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect;
11 const compile_time_constant_b_test = Object.create(null);
12 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr ray$(core.String)))();
13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c ore.int)))();
14 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT ype(core.bool, [dart.dynamic])))();
15 let StringAndintTovoid = () => (StringAndintTovoid = dart.constFn(dart.definit eFunctionType(dart.void, [core.String, core.int])))();
16 let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core .int, [])))();
17 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
19 compile_time_constant_b_test.m1 = dart.const(dart.map({__proto__: 400 + 99}));
20 compile_time_constant_b_test.m2 = dart.const(dart.map({a: 499, b: 42}));
21 compile_time_constant_b_test.m3 = dart.const(dart.map({__proto__: 499}));
22 compile_time_constant_b_test.isUnsupportedError = function(o) {
23 return core.UnsupportedError.is(o);
24 };
25 dart.fn(compile_time_constant_b_test.isUnsupportedError, dynamicTobool());
26 compile_time_constant_b_test.main = function() {
27 expect$.Expect.equals(499, compile_time_constant_b_test.m1[dartx.get]('__pro to__'));
28 expect$.Expect.equals(null, compile_time_constant_b_test.m1[dartx.get]('b')) ;
29 expect$.Expect.listEquals(JSArrayOfString().of(['__proto__']), compile_time_ constant_b_test.m1[dartx.keys][dartx.toList]());
30 expect$.Expect.listEquals(JSArrayOfint().of([499]), compile_time_constant_b_ test.m1[dartx.values][dartx.toList]());
31 expect$.Expect.isTrue(compile_time_constant_b_test.m1[dartx.containsKey]('__ proto__'));
32 expect$.Expect.isFalse(compile_time_constant_b_test.m1[dartx.containsKey]('t oString'));
33 expect$.Expect.isTrue(compile_time_constant_b_test.m1[dartx.containsValue](4 99));
34 expect$.Expect.isFalse(compile_time_constant_b_test.m1[dartx.containsValue]( null));
35 let seenKeys = [];
36 let seenValues = [];
37 compile_time_constant_b_test.m1[dartx.forEach](dart.fn((key, value) => {
38 seenKeys[dartx.add](key);
39 seenValues[dartx.add](value);
40 }, StringAndintTovoid()));
41 expect$.Expect.listEquals(JSArrayOfString().of(['__proto__']), seenKeys);
42 expect$.Expect.listEquals(JSArrayOfint().of([499]), seenValues);
43 expect$.Expect.isFalse(compile_time_constant_b_test.m1[dartx.isEmpty]);
44 expect$.Expect.equals(1, compile_time_constant_b_test.m1[dartx.length]);
45 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.re move]('__proto__'), VoidToint()), compile_time_constant_b_test.isUnsupportedErro r);
46 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.re move]('b'), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
47 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.cl ear](), VoidTovoid()), compile_time_constant_b_test.isUnsupportedError);
48 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.se t]('b', 42), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
49 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.se t]('__proto__', 499), VoidToint()), compile_time_constant_b_test.isUnsupportedEr ror);
50 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.pu tIfAbsent]('__proto__', dart.fn(() => 499, VoidToint())), VoidToint()), compile_ time_constant_b_test.isUnsupportedError);
51 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m1[dartx.pu tIfAbsent]('z', dart.fn(() => 499, VoidToint())), VoidToint()), compile_time_con stant_b_test.isUnsupportedError);
52 expect$.Expect.equals(499, compile_time_constant_b_test.m2[dartx.get]('a'));
53 expect$.Expect.equals(42, compile_time_constant_b_test.m2[dartx.get]('b'));
54 expect$.Expect.equals(null, compile_time_constant_b_test.m2[dartx.get]('c')) ;
55 expect$.Expect.equals(null, compile_time_constant_b_test.m2[dartx.get]('__pr oto__'));
56 expect$.Expect.listEquals(JSArrayOfString().of(['a', 'b']), compile_time_con stant_b_test.m2[dartx.keys][dartx.toList]());
57 expect$.Expect.listEquals(JSArrayOfint().of([499, 42]), compile_time_constan t_b_test.m2[dartx.values][dartx.toList]());
58 expect$.Expect.isTrue(compile_time_constant_b_test.m2[dartx.containsKey]('a' ));
59 expect$.Expect.isTrue(compile_time_constant_b_test.m2[dartx.containsKey]('b' ));
60 expect$.Expect.isFalse(compile_time_constant_b_test.m2[dartx.containsKey]('t oString'));
61 expect$.Expect.isFalse(compile_time_constant_b_test.m2[dartx.containsKey]('_ _proto__'));
62 expect$.Expect.isTrue(compile_time_constant_b_test.m2[dartx.containsValue](4 99));
63 expect$.Expect.isTrue(compile_time_constant_b_test.m2[dartx.containsValue](4 2));
64 expect$.Expect.isFalse(compile_time_constant_b_test.m2[dartx.containsValue]( null));
65 seenKeys = [];
66 seenValues = [];
67 compile_time_constant_b_test.m2[dartx.forEach](dart.fn((key, value) => {
68 seenKeys[dartx.add](key);
69 seenValues[dartx.add](value);
70 }, StringAndintTovoid()));
71 expect$.Expect.listEquals(JSArrayOfString().of(['a', 'b']), seenKeys);
72 expect$.Expect.listEquals(JSArrayOfint().of([499, 42]), seenValues);
73 expect$.Expect.isFalse(compile_time_constant_b_test.m2[dartx.isEmpty]);
74 expect$.Expect.equals(2, compile_time_constant_b_test.m2[dartx.length]);
75 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.re move]('a'), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
76 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.re move]('b'), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
77 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.re move]('__proto__'), VoidToint()), compile_time_constant_b_test.isUnsupportedErro r);
78 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.cl ear](), VoidTovoid()), compile_time_constant_b_test.isUnsupportedError);
79 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.se t]('a', 499), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
80 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.se t]('b', 42), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
81 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.se t]('__proto__', 499), VoidToint()), compile_time_constant_b_test.isUnsupportedEr ror);
82 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.pu tIfAbsent]('a', dart.fn(() => 499, VoidToint())), VoidToint()), compile_time_con stant_b_test.isUnsupportedError);
83 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.pu tIfAbsent]('__proto__', dart.fn(() => 499, VoidToint())), VoidToint()), compile_ time_constant_b_test.isUnsupportedError);
84 expect$.Expect.throws(dart.fn(() => compile_time_constant_b_test.m2[dartx.se t]('a', 499), VoidToint()), compile_time_constant_b_test.isUnsupportedError);
85 expect$.Expect.isTrue(core.identical(compile_time_constant_b_test.m1, compil e_time_constant_b_test.m3));
86 };
87 dart.fn(compile_time_constant_b_test.main, VoidTodynamic());
88 // Exports:
89 exports.compile_time_constant_b_test = compile_time_constant_b_test;
90 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698