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

Side by Side Diff: test/codegen/expect/language/async_switch_test_none_multi.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/async_switch_test_none_multi', null, /* Imports * /[
2 'dart_sdk',
3 'expect',
4 'async_helper'
5 ], function load__async_switch_test_none_multi(exports, dart_sdk, expect, async_ helper) {
6 'use strict';
7 const core = dart_sdk.core;
8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect;
11 const async_helper$ = async_helper.async_helper;
12 const async_switch_test_none_multi = Object.create(null);
13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
15 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
16 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
17 async_switch_test_none_multi.foo1 = function(a) {
18 return dart.async(function*(a) {
19 let k = 0;
20 switch (a) {
21 case 1:
22 {
23 yield 3;
24 k = dart.notNull(k) + 1;
25 break;
26 }
27 case 2:
28 {
29 k = dart.notNull(k) + dart.notNull(core.int._check(a));
30 return dart.notNull(k) + 2;
31 }
32 }
33 return k;
34 }, dart.dynamic, a);
35 };
36 dart.fn(async_switch_test_none_multi.foo1, dynamicTodynamic());
37 async_switch_test_none_multi.foo2 = function(a) {
38 return dart.async(function*(a) {
39 let k = 0;
40 switch (yield a) {
41 case 1:
42 {
43 yield 3;
44 k = dart.notNull(k) + 1;
45 break;
46 }
47 case 2:
48 {
49 k = dart.notNull(k) + dart.notNull(core.int._check(yield a));
50 return dart.notNull(k) + 2;
51 }
52 }
53 return k;
54 }, dart.dynamic, a);
55 };
56 dart.fn(async_switch_test_none_multi.foo2, dynamicTodynamic());
57 async_switch_test_none_multi.foo3 = function(a) {
58 return dart.async(function*(a) {
59 let k = 0;
60 switch (a) {
61 case 1:
62 {
63 k = dart.notNull(k) + 1;
64 break;
65 }
66 case 2:
67 {
68 k = dart.notNull(k) + dart.notNull(core.int._check(a));
69 return dart.notNull(k) + 2;
70 }
71 }
72 return k;
73 }, dart.dynamic, a);
74 };
75 dart.fn(async_switch_test_none_multi.foo3, dynamicTodynamic());
76 async_switch_test_none_multi.foo4 = function(value) {
77 return dart.async(function*(value) {
78 let k = 0;
79 switch (yield value) {
80 case 1:
81 {
82 k = k + 1;
83 break;
84 }
85 case 2:
86 {
87 k = k + 2;
88 return 2 + k;
89 }
90 }
91 return k;
92 }, dart.dynamic, value);
93 };
94 dart.fn(async_switch_test_none_multi.foo4, dynamicTodynamic());
95 async_switch_test_none_multi.futureOf = function(a) {
96 return dart.async(function*(a) {
97 return yield a;
98 }, dart.dynamic, a);
99 };
100 dart.fn(async_switch_test_none_multi.futureOf, dynamicTodynamic());
101 async_switch_test_none_multi.test = function() {
102 return dart.async(function*() {
103 expect$.Expect.equals(1, yield async_switch_test_none_multi.foo1(1));
104 expect$.Expect.equals(4, yield async_switch_test_none_multi.foo1(2));
105 expect$.Expect.equals(0, yield async_switch_test_none_multi.foo1(3));
106 expect$.Expect.equals(1, yield async_switch_test_none_multi.foo2(async_swi tch_test_none_multi.futureOf(1)));
107 expect$.Expect.equals(4, yield async_switch_test_none_multi.foo2(async_swi tch_test_none_multi.futureOf(2)));
108 expect$.Expect.equals(0, yield async_switch_test_none_multi.foo2(async_swi tch_test_none_multi.futureOf(3)));
109 expect$.Expect.equals(1, yield async_switch_test_none_multi.foo3(1));
110 expect$.Expect.equals(4, yield async_switch_test_none_multi.foo3(2));
111 expect$.Expect.equals(0, yield async_switch_test_none_multi.foo3(3));
112 expect$.Expect.equals(1, yield async_switch_test_none_multi.foo4(async_swi tch_test_none_multi.futureOf(1)));
113 expect$.Expect.equals(4, yield async_switch_test_none_multi.foo4(async_swi tch_test_none_multi.futureOf(2)));
114 expect$.Expect.equals(0, yield async_switch_test_none_multi.foo4(async_swi tch_test_none_multi.futureOf(3)));
115 }, dart.dynamic);
116 };
117 dart.fn(async_switch_test_none_multi.test, VoidTodynamic());
118 async_switch_test_none_multi.main = function() {
119 async_helper$.asyncStart();
120 dart.dsend(async_switch_test_none_multi.test(), 'then', dart.fn(_ => async_h elper$.asyncEnd(), dynamicTovoid()));
121 };
122 dart.fn(async_switch_test_none_multi.main, VoidTovoid());
123 // Exports:
124 exports.async_switch_test_none_multi = async_switch_test_none_multi;
125 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698