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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/language/async_switch_test_none_multi.js
diff --git a/test/codegen/expect/language/async_switch_test_none_multi.js b/test/codegen/expect/language/async_switch_test_none_multi.js
new file mode 100644
index 0000000000000000000000000000000000000000..34b562ea506ad90633c3e8abd3219fd348377368
--- /dev/null
+++ b/test/codegen/expect/language/async_switch_test_none_multi.js
@@ -0,0 +1,125 @@
+dart_library.library('language/async_switch_test_none_multi', null, /* Imports */[
+ 'dart_sdk',
+ 'expect',
+ 'async_helper'
+], function load__async_switch_test_none_multi(exports, dart_sdk, expect, async_helper) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const async_helper$ = async_helper.async_helper;
+ const async_switch_test_none_multi = Object.create(null);
+ let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))();
+ let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
+ async_switch_test_none_multi.foo1 = function(a) {
+ return dart.async(function*(a) {
+ let k = 0;
+ switch (a) {
+ case 1:
+ {
+ yield 3;
+ k = dart.notNull(k) + 1;
+ break;
+ }
+ case 2:
+ {
+ k = dart.notNull(k) + dart.notNull(core.int._check(a));
+ return dart.notNull(k) + 2;
+ }
+ }
+ return k;
+ }, dart.dynamic, a);
+ };
+ dart.fn(async_switch_test_none_multi.foo1, dynamicTodynamic());
+ async_switch_test_none_multi.foo2 = function(a) {
+ return dart.async(function*(a) {
+ let k = 0;
+ switch (yield a) {
+ case 1:
+ {
+ yield 3;
+ k = dart.notNull(k) + 1;
+ break;
+ }
+ case 2:
+ {
+ k = dart.notNull(k) + dart.notNull(core.int._check(yield a));
+ return dart.notNull(k) + 2;
+ }
+ }
+ return k;
+ }, dart.dynamic, a);
+ };
+ dart.fn(async_switch_test_none_multi.foo2, dynamicTodynamic());
+ async_switch_test_none_multi.foo3 = function(a) {
+ return dart.async(function*(a) {
+ let k = 0;
+ switch (a) {
+ case 1:
+ {
+ k = dart.notNull(k) + 1;
+ break;
+ }
+ case 2:
+ {
+ k = dart.notNull(k) + dart.notNull(core.int._check(a));
+ return dart.notNull(k) + 2;
+ }
+ }
+ return k;
+ }, dart.dynamic, a);
+ };
+ dart.fn(async_switch_test_none_multi.foo3, dynamicTodynamic());
+ async_switch_test_none_multi.foo4 = function(value) {
+ return dart.async(function*(value) {
+ let k = 0;
+ switch (yield value) {
+ case 1:
+ {
+ k = k + 1;
+ break;
+ }
+ case 2:
+ {
+ k = k + 2;
+ return 2 + k;
+ }
+ }
+ return k;
+ }, dart.dynamic, value);
+ };
+ dart.fn(async_switch_test_none_multi.foo4, dynamicTodynamic());
+ async_switch_test_none_multi.futureOf = function(a) {
+ return dart.async(function*(a) {
+ return yield a;
+ }, dart.dynamic, a);
+ };
+ dart.fn(async_switch_test_none_multi.futureOf, dynamicTodynamic());
+ async_switch_test_none_multi.test = function() {
+ return dart.async(function*() {
+ expect$.Expect.equals(1, yield async_switch_test_none_multi.foo1(1));
+ expect$.Expect.equals(4, yield async_switch_test_none_multi.foo1(2));
+ expect$.Expect.equals(0, yield async_switch_test_none_multi.foo1(3));
+ expect$.Expect.equals(1, yield async_switch_test_none_multi.foo2(async_switch_test_none_multi.futureOf(1)));
+ expect$.Expect.equals(4, yield async_switch_test_none_multi.foo2(async_switch_test_none_multi.futureOf(2)));
+ expect$.Expect.equals(0, yield async_switch_test_none_multi.foo2(async_switch_test_none_multi.futureOf(3)));
+ expect$.Expect.equals(1, yield async_switch_test_none_multi.foo3(1));
+ expect$.Expect.equals(4, yield async_switch_test_none_multi.foo3(2));
+ expect$.Expect.equals(0, yield async_switch_test_none_multi.foo3(3));
+ expect$.Expect.equals(1, yield async_switch_test_none_multi.foo4(async_switch_test_none_multi.futureOf(1)));
+ expect$.Expect.equals(4, yield async_switch_test_none_multi.foo4(async_switch_test_none_multi.futureOf(2)));
+ expect$.Expect.equals(0, yield async_switch_test_none_multi.foo4(async_switch_test_none_multi.futureOf(3)));
+ }, dart.dynamic);
+ };
+ dart.fn(async_switch_test_none_multi.test, VoidTodynamic());
+ async_switch_test_none_multi.main = function() {
+ async_helper$.asyncStart();
+ dart.dsend(async_switch_test_none_multi.test(), 'then', dart.fn(_ => async_helper$.asyncEnd(), dynamicTovoid()));
+ };
+ dart.fn(async_switch_test_none_multi.main, VoidTovoid());
+ // Exports:
+ exports.async_switch_test_none_multi = async_switch_test_none_multi;
+});

Powered by Google App Engine
This is Rietveld 408576698