Bug 1185106 - Part 11.5: Add async function constructor and prototype. r=till
authorTooru Fujisawa <arai_a@mac.com>
Mon, 29 Aug 2016 02:06:19 +0900
changeset 320250 a141cb00c7deef08035c09de9ebd720fd74ff7a7
parent 320249 707c862f4d63f444a307aca6f7f5ecf1bd0cc070
child 320251 4dbc392a25d8a1978b5e9802561375b502d19c19
push id20754
push usercbook@mozilla.com
push dateMon, 31 Oct 2016 15:58:35 +0000
treeherderfx-team@b1b66b1780c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1185106
milestone52.0a1
Bug 1185106 - Part 11.5: Add async function constructor and prototype. r=till MozReview-Commit-ID: DKdeWuAdhrY
js/src/tests/ecma_7/AsyncFunctions/constructor.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_7/AsyncFunctions/constructor.js
@@ -0,0 +1,33 @@
+var BUGNUMBER = 1185106;
+var summary = "async function constructor and prototype";
+
+print(BUGNUMBER + ": " + summary);
+
+var f1 = async function() {};
+
+var AsyncFunction = f1.constructor;
+var AsyncFunctionPrototype = AsyncFunction.prototype;
+
+assertEq(AsyncFunction.name, "AsyncFunction");
+assertEq(AsyncFunction.length, 1);
+assertEq(Object.getPrototypeOf(async function() {}), AsyncFunctionPrototype);
+
+assertEq(AsyncFunctionPrototype.constructor, AsyncFunction);
+
+var f2 = AsyncFunction("await 1");
+assertEq(f2.constructor, AsyncFunction);
+assertEq(f2.length, 0);
+assertEq(Object.getPrototypeOf(f2), AsyncFunctionPrototype);
+
+var f3 = new AsyncFunction("await 1");
+assertEq(f3.constructor, AsyncFunction);
+assertEq(f3.length, 0);
+assertEq(Object.getPrototypeOf(f3), AsyncFunctionPrototype);
+
+var f4 = AsyncFunction("a", "b", "c", "await 1");
+assertEq(f4.constructor, AsyncFunction);
+assertEq(f4.length, 3);
+assertEq(Object.getPrototypeOf(f4), AsyncFunctionPrototype);
+
+if (typeof reportCompare === "function")
+    reportCompare(true, true);