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

Unified Diff: test/codegen/expect/language/call_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
« no previous file with comments | « test/codegen/expect/language/call_property_test.js ('k') | test/codegen/expect/language/call_this_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/language/call_test.js
diff --git a/test/codegen/expect/language/call_test.js b/test/codegen/expect/language/call_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..7451df34d26a0183ee2fdfe07b48adbbd2de454a
--- /dev/null
+++ b/test/codegen/expect/language/call_test.js
@@ -0,0 +1,60 @@
+dart_library.library('language/call_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__call_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const call_test = Object.create(null);
+ let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
+ let __Todynamic = () => (__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic])))();
+ let __Todynamic$ = () => (__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [], {x: dart.dynamic, y: dart.dynamic})))();
+ let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
+ let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ call_test.main = function() {
+ function bar(a) {
+ return typeof a == 'string';
+ }
+ dart.fn(bar, dynamicTodynamic());
+ for (let i = 0; i < 20; i++) {
+ expect$.Expect.isFalse(bar(1));
+ expect$.Expect.isTrue(dart.dsend(bar, 'call', 'foo'));
+ }
+ function opt_arg(a) {
+ if (a === void 0) a = "a";
+ return typeof a == 'string';
+ }
+ dart.fn(opt_arg, __Todynamic());
+ for (let i = 0; i < 20; i++) {
+ expect$.Expect.isFalse(opt_arg(1));
+ expect$.Expect.isFalse(dart.dsend(opt_arg, 'call', 1));
+ expect$.Expect.isTrue(opt_arg());
+ expect$.Expect.isTrue(dart.dsend(opt_arg, 'call'));
+ expect$.Expect.isTrue(opt_arg("b"));
+ expect$.Expect.isTrue(dart.dsend(opt_arg, 'call', "b"));
+ }
+ function named_arg(opts) {
+ let x = opts && 'x' in opts ? opts.x : 11;
+ let y = opts && 'y' in opts ? opts.y : 22;
+ return dart.str`${x}${y}`;
+ }
+ dart.fn(named_arg, __Todynamic$());
+ for (let i = 0; i < 20; i++) {
+ expect$.Expect.equals("1122", named_arg());
+ expect$.Expect.equals("1122", dart.dsend(named_arg, 'call'));
+ expect$.Expect.equals("4455", named_arg({y: 55, x: 44}));
+ expect$.Expect.equals("4455", dart.dsend(named_arg, 'call', {y: 55, x: 44}));
+ expect$.Expect.equals("4455", named_arg({x: 44, y: 55}));
+ expect$.Expect.equals("4455", dart.dsend(named_arg, 'call', {x: 44, y: 55}));
+ }
+ expect$.Expect.throws(dart.fn(() => dart.dsend(bar, 'call'), VoidTovoid()), dart.fn(e => core.NoSuchMethodError.is(e), dynamicTobool()));
+ expect$.Expect.throws(dart.fn(() => dart.dsend(opt_arg, 'call', {x: "p"}), VoidTovoid()), dart.fn(e => core.NoSuchMethodError.is(e), dynamicTobool()));
+ expect$.Expect.throws(dart.fn(() => dart.dsend(named_arg, 'call', "p", "q"), VoidTovoid()), dart.fn(e => core.NoSuchMethodError.is(e), dynamicTobool()));
+ };
+ dart.fn(call_test.main, VoidTodynamic());
+ // Exports:
+ exports.call_test = call_test;
+});
« no previous file with comments | « test/codegen/expect/language/call_property_test.js ('k') | test/codegen/expect/language/call_this_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698