diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/non262/async-functions/constructor.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/async-functions/constructor.js')
-rw-r--r-- | js/src/tests/non262/async-functions/constructor.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/non262/async-functions/constructor.js b/js/src/tests/non262/async-functions/constructor.js new file mode 100644 index 0000000000..ccacb4363a --- /dev/null +++ b/js/src/tests/non262/async-functions/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); |