summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/super
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/test262/language/statements/class/super
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/test262/language/statements/class/super')
-rw-r--r--js/src/tests/test262/language/statements/class/super/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js19
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-constructor.js23
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-getter.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-methods.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-setter.js25
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-getter.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-methods.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-setter.js25
-rw-r--r--js/src/tests/test262/language/statements/class/super/shell.js0
10 files changed, 188 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/super/browser.js b/js/src/tests/test262/language/statements/class/super/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/browser.js
diff --git a/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js b/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js
new file mode 100644
index 0000000000..43ef9d6bc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2018 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ SuperProperty evaluation order: super() thisBinding initialization must occur first.
+---*/
+class Derived extends Object {
+ constructor() {
+ super[super()];
+ throw new Test262Error();
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new Derived();
+}, '`super[super()]` via `new Derived()` throws a ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-constructor.js b/js/src/tests/test262/language/statements/class/super/in-constructor.js
new file mode 100644
index 0000000000..e635c94ed4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-constructor.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in constructor
+---*/
+var calls = 0;
+class B {}
+B.prototype.x = 42;
+
+class C extends B {
+ constructor() {
+ super();
+ calls++;
+ assert.sameValue(super.x, 42, "The value of `super.x` is `42`");
+ }
+}
+
+new C;
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-getter.js b/js/src/tests/test262/language/statements/class/super/in-getter.js
new file mode 100644
index 0000000000..b8be37b2a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-getter.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in getter
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ get y() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(new C().y, 1, "The value of `new C().y` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-methods.js b/js/src/tests/test262/language/statements/class/super/in-methods.js
new file mode 100644
index 0000000000..90d2e08c66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-methods.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in methods
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ method() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(new C().method(), 1, "`new C().method()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-setter.js b/js/src/tests/test262/language/statements/class/super/in-setter.js
new file mode 100644
index 0000000000..52cade7f64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-setter.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in setter
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ set y(v) {
+ assert.sameValue(v, 3, "The value of `v` is `3`");
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
+ }
+}
+assert.sameValue(new C().y = 3, 3, "`new C().y = 3` is `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-getter.js b/js/src/tests/test262/language/statements/class/super/in-static-getter.js
new file mode 100644
index 0000000000..edff783e68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-getter.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static getter
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static get x() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(C.x, 1, "The value of `C.x` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-methods.js b/js/src/tests/test262/language/statements/class/super/in-static-methods.js
new file mode 100644
index 0000000000..1d6808e0a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-methods.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static methods
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static method() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(C.method(), 1, "`C.method()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-setter.js b/js/src/tests/test262/language/statements/class/super/in-static-setter.js
new file mode 100644
index 0000000000..e870d302a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-setter.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static setter
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static set x(v) {
+ assert.sameValue(v, 3, "The value of `v` is `3`");
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
+ }
+}
+assert.sameValue(C.x = 3, 3, "`C.x = 3` is `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/shell.js b/js/src/tests/test262/language/statements/class/super/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/shell.js