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

Side by Side Diff: test/codegen/expect/language/async_star_stream_take_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/async_star_stream_take_test', null, /* Imports */ [
2 'dart_sdk',
3 'async_helper',
4 'expect'
5 ], function load__async_star_stream_take_test(exports, dart_sdk, async_helper, e xpect) {
6 'use strict';
7 const core = dart_sdk.core;
8 const async = dart_sdk.async;
9 const dart = dart_sdk.dart;
10 const dartx = dart_sdk.dartx;
11 const async_helper$ = async_helper.async_helper;
12 const expect$ = expect.expect;
13 const async_star_stream_take_test = Object.create(null);
14 let intToStream = () => (intToStream = dart.constFn(dart.definiteFunctionType( async.Stream, [core.int])))();
15 let StreamTodynamic = () => (StreamTodynamic = dart.constFn(dart.definiteFunct ionType(dart.dynamic, [async.Stream])))();
16 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
17 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
18 async_star_stream_take_test.makeStream = function(n) {
19 return dart.asyncStar(function*(stream, n) {
20 for (let i = 0; i < dart.notNull(n); i++) {
21 if (stream.add(i)) return;
22 yield;
23 }
24 }, dart.dynamic, n);
25 };
26 dart.fn(async_star_stream_take_test.makeStream, intToStream());
27 async_star_stream_take_test.main = function() {
28 function f(s) {
29 return dart.async(function*(s) {
30 let r = 0;
31 let it = async.StreamIterator.new(s.take(5));
32 try {
33 while (yield it.moveNext()) {
34 let v = it.current;
35 r = dart.notNull(r) + dart.notNull(core.int._check(v));
36 }
37 } finally {
38 yield it.cancel();
39 }
40 return r;
41 }, dart.dynamic, s);
42 }
43 dart.fn(f, StreamTodynamic());
44 async_helper$.asyncStart();
45 dart.dsend(f(async_star_stream_take_test.makeStream(10)), 'then', dart.fn(v => {
46 expect$.Expect.equals(10, v);
47 async_helper$.asyncEnd();
48 }, dynamicTodynamic()));
49 };
50 dart.fn(async_star_stream_take_test.main, VoidTodynamic());
51 // Exports:
52 exports.async_star_stream_take_test = async_star_stream_take_test;
53 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698