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

Unified Diff: test/codegen/expect/language/pure_function2_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 side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/language/pure_function2_test.js
diff --git a/test/codegen/expect/language/pure_function2_test.js b/test/codegen/expect/language/pure_function2_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..4689c83baa0ae783fbbfb120d4661b34eb3aa9a8
--- /dev/null
+++ b/test/codegen/expect/language/pure_function2_test.js
@@ -0,0 +1,45 @@
+dart_library.library('language/pure_function2_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__pure_function2_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const _interceptors = dart_sdk._interceptors;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const pure_function2_test = Object.create(null);
+ let JSArrayOfObject = () => (JSArrayOfObject = dart.constFn(_interceptors.JSArray$(core.Object)))();
+ let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ pure_function2_test.confuse = function(x) {
+ if (new core.DateTime.now().millisecondsSinceEpoch == 42) return pure_function2_test.confuse(x);
+ return x;
+ };
+ dart.fn(pure_function2_test.confuse, dynamicTodynamic());
+ pure_function2_test.foo = function(trace) {
+ dart.dsend(trace, 'add', "foo");
+ return "foo";
+ };
+ dart.fn(pure_function2_test.foo, dynamicTodynamic());
+ pure_function2_test.bar = function(trace) {
+ dart.dsend(trace, 'add', "bar");
+ return "bar";
+ };
+ dart.fn(pure_function2_test.bar, dynamicTodynamic());
+ pure_function2_test.main = function() {
+ let f = pure_function2_test.confuse(pure_function2_test.foo);
+ let b = pure_function2_test.confuse(pure_function2_test.bar);
+ let trace = [];
+ let t1 = dart.dcall(f, trace);
+ let t2 = dart.dcall(b, trace);
+ let t3 = core.identical(t2, "foo");
+ let t4 = trace[dartx.add](t1);
+ trace[dartx.add](t3);
+ trace[dartx.add](t3);
+ expect$.Expect.listEquals(JSArrayOfObject().of(["foo", "bar", "foo", false, false]), trace);
+ };
+ dart.fn(pure_function2_test.main, VoidTodynamic());
+ // Exports:
+ exports.pure_function2_test = pure_function2_test;
+});
« no previous file with comments | « test/codegen/expect/language/proxy_test_none_multi.js ('k') | test/codegen/expect/language/pure_function_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698