summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds
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/built-ins/Date/prototype/setUTCSeconds
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/built-ins/Date/prototype/setUTCSeconds')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js42
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js0
12 files changed, 263 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js
new file mode 100644
index 0000000000..1d75241ef8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.setUTCSeconds;
+if (x === 1) {
+ Date.prototype.setUTCSeconds = 2;
+} else {
+ Date.prototype.setUTCSeconds = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.setUTCSeconds,
+ x,
+ 'The value of Date.prototype.setUTCSeconds is expected to not equal the value of `x`'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js
new file mode 100644
index 0000000000..4a0cfaa0f6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.setUTCSeconds,
+ false,
+ 'The value of delete Date.prototype.setUTCSeconds is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('setUTCSeconds'),
+ 'The value of !Date.prototype.hasOwnProperty(\'setUTCSeconds\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js
new file mode 100644
index 0000000000..efb81dd571
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('setUTCSeconds'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCSeconds\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "setUTCSeconds", 'The value of x is not "setUTCSeconds"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js
new file mode 100644
index 0000000000..314194b4c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The "length" property of the "setUTCSeconds" is 2
+esid: sec-date.prototype.setutcseconds
+description: The "length" property of the "setUTCSeconds" is 2
+---*/
+assert.sameValue(
+ Date.prototype.setUTCSeconds.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.setUTCSeconds.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.setUTCSeconds.length,
+ 2,
+ 'The value of Date.prototype.setUTCSeconds.length is expected to be 2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js
new file mode 100644
index 0000000000..422b8d2f54
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Date.prototype.setUTCSeconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.setUTCSeconds.length;
+verifyNotWritable(Date.prototype.setUTCSeconds, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.setUTCSeconds.length,
+ x,
+ 'The value of Date.prototype.setUTCSeconds.length is expected to equal the value of x'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js
new file mode 100644
index 0000000000..195b848893
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Date.prototype.setUTCSeconds property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.setUTCSeconds.length,
+ true,
+ 'The value of `delete Date.prototype.setUTCSeconds.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.setUTCSeconds.hasOwnProperty('length'),
+ 'The value of !Date.prototype.setUTCSeconds.hasOwnProperty(\'length\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js
new file mode 100644
index 0000000000..aec6f68e8d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Date.prototype.setUTCSeconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.setUTCSeconds.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.setUTCSeconds.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.setUTCSeconds) {
+ assert.notSameValue(x, "length", 'The value of x is not "length"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js
new file mode 100644
index 0000000000..a453b5a2c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.prototype.setutcseconds
+description: Order of coercion of provided arguments vs NaN check
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. Let s be ? ToNumber(sec).
+ 3. If ms is present, let milli be ? ToNumber(ms).
+ 4. If t is NaN, return NaN.
+ 5. If ms is not present, let milli be msFromTime(t).
+ 6. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli)).
+ 7. Let v be TimeClip(date).
+ 8. Set the [[DateValue]] internal slot of this Date object to v.
+ 9. Return v.
+includes: [compareArray.js]
+---*/
+
+var date = new Date(NaN);
+var effects = [];
+var argSec = {
+ valueOf: function() {
+ effects.push('valueOf sec');
+ return 0;
+ }
+};
+var argMs = {
+ valueOf: function() {
+ effects.push('valueOf ms');
+ return 0;
+ }
+};
+
+var returnValue = date.setUTCSeconds(argSec, argMs);
+
+var expectedEffects = ['valueOf sec', 'valueOf ms'];
+
+assert.compareArray(effects, expectedEffects);
+assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date');
+assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js
new file mode 100644
index 0000000000..b73874e84a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.setutcseconds
+description: >
+ Date.prototype.setUTCSeconds.name is "setUTCSeconds".
+info: |
+ Date.prototype.setUTCSeconds ( sec [ , ms ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Date.prototype.setUTCSeconds.name, "setUTCSeconds");
+
+verifyNotEnumerable(Date.prototype.setUTCSeconds, "name");
+verifyNotWritable(Date.prototype.setUTCSeconds, "name");
+verifyConfigurable(Date.prototype.setUTCSeconds, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js
new file mode 100644
index 0000000000..b6eebae507
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Date.prototype.setUTCSeconds does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Date.prototype.setUTCSeconds),
+ false,
+ 'isConstructor(Date.prototype.setUTCSeconds) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.setUTCSeconds();
+}, '`let date = new Date(Date.now()); new date.setUTCSeconds()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js