summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Function/function-name-computed-02.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/Function/function-name-computed-02.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/Function/function-name-computed-02.js')
-rw-r--r--js/src/tests/non262/Function/function-name-computed-02.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/tests/non262/Function/function-name-computed-02.js b/js/src/tests/non262/Function/function-name-computed-02.js
new file mode 100644
index 0000000000..54048aee49
--- /dev/null
+++ b/js/src/tests/non262/Function/function-name-computed-02.js
@@ -0,0 +1,57 @@
+var obj = {
+ [1]: function() {},
+ [2]: function*() {},
+ [3]: async function() {},
+ [4]: async function*() {},
+ [5]: ()=>{},
+ [6]: async ()=>{},
+ [7] () {},
+ [8]: class {},
+ [9]: function F() {},
+ [10]: class C{},
+ get [11]() {},
+ set [12](x) {},
+};
+
+assertEq(obj[1].name, "1");
+assertEq(obj[2].name, "2");
+assertEq(obj[3].name, "3");
+assertEq(obj[4].name, "4");
+assertEq(obj[5].name, "5");
+assertEq(obj[6].name, "6");
+assertEq(obj[7].name, "7");
+assertEq(obj[8].name, "8");
+assertEq(obj[9].name, "F");
+assertEq(obj[10].name, "C");
+assertEq(Object.getOwnPropertyDescriptor(obj, "11").get.name, "get 11");
+assertEq(Object.getOwnPropertyDescriptor(obj, "12").set.name, "set 12");
+
+let dummy = class {
+ [1]() {}
+ *[2]() {}
+ async [3]() {}
+ async *[4]() {}
+ [5] = ()=>{}
+ [6] = async ()=>{};
+ [7] () {}
+ get [11]() {}
+ set [12](x) {}
+};
+
+dum = new dummy();
+
+assertEq(dum[1].name, "1");
+assertEq(dum[2].name, "2");
+assertEq(dum[3].name, "3");
+assertEq(dum[4].name, "4");
+assertEq(dum[5].name, "5");
+assertEq(dum[6].name, "6");
+assertEq(dum[7].name, "7");
+
+assertEq(Object.getOwnPropertyDescriptor(dummy.prototype, "11").get.name, "get 11");
+assertEq(Object.getOwnPropertyDescriptor(dummy.prototype, "12").set.name, "set 12");
+
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+