summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js27
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js13
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js36
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js46
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js25
15 files changed, 347 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js
new file mode 100644
index 0000000000..d9028f85d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js
@@ -0,0 +1,27 @@
+// 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 "getUTCMilliseconds" has { DontEnum }
+ attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.getUTCMilliseconds;
+if (x === 1) {
+ Date.prototype.getUTCMilliseconds = 2;
+} else {
+ Date.prototype.getUTCMilliseconds = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.getUTCMilliseconds,
+ x,
+ 'The value of Date.prototype.getUTCMilliseconds 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/getUTCMilliseconds/S15.9.5.25_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js
new file mode 100644
index 0000000000..54830aa061
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_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 property "getUTCMilliseconds" has { DontEnum }
+ attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.getUTCMilliseconds,
+ false,
+ 'The value of delete Date.prototype.getUTCMilliseconds is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('getUTCMilliseconds'),
+ 'The value of !Date.prototype.hasOwnProperty(\'getUTCMilliseconds\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js
new file mode 100644
index 0000000000..7537023057
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_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 property "getUTCMilliseconds" has { DontEnum }
+ attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('getUTCMilliseconds'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCMilliseconds\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "getUTCMilliseconds", 'The value of x is not "getUTCMilliseconds"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js
new file mode 100644
index 0000000000..6aca17be30
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_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 "getUTCMilliseconds" is 0
+esid: sec-date.prototype.getutcmilliseconds
+description: The "length" property of the "getUTCMilliseconds" is 0
+---*/
+assert.sameValue(
+ Date.prototype.getUTCMilliseconds.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.getUTCMilliseconds.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.getUTCMilliseconds.length,
+ 0,
+ 'The value of Date.prototype.getUTCMilliseconds.length is expected to be 0'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js
new file mode 100644
index 0000000000..751e632a31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_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.getUTCMilliseconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.getUTCMilliseconds.length;
+verifyNotWritable(Date.prototype.getUTCMilliseconds, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.getUTCMilliseconds.length,
+ x,
+ 'The value of Date.prototype.getUTCMilliseconds.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/getUTCMilliseconds/S15.9.5.25_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js
new file mode 100644
index 0000000000..d04f69662d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_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.getUTCMilliseconds property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.getUTCMilliseconds.length,
+ true,
+ 'The value of `delete Date.prototype.getUTCMilliseconds.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.getUTCMilliseconds.hasOwnProperty('length'),
+ 'The value of !Date.prototype.getUTCMilliseconds.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/getUTCMilliseconds/S15.9.5.25_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js
new file mode 100644
index 0000000000..6fb9ff17f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_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.getUTCMilliseconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutcmilliseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.getUTCMilliseconds.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.getUTCMilliseconds.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.getUTCMilliseconds) {
+ 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/getUTCMilliseconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js
new file mode 100644
index 0000000000..1a723340a3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/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.getutcmilliseconds
+description: >
+ Date.prototype.getUTCMilliseconds.name is "getUTCMilliseconds".
+info: |
+ Date.prototype.getUTCMilliseconds ( )
+
+ 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.getUTCMilliseconds.name, "getUTCMilliseconds");
+
+verifyNotEnumerable(Date.prototype.getUTCMilliseconds, "name");
+verifyNotWritable(Date.prototype.getUTCMilliseconds, "name");
+verifyConfigurable(Date.prototype.getUTCMilliseconds, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js
new file mode 100644
index 0000000000..b9e17b9792
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/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.getUTCMilliseconds 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.getUTCMilliseconds),
+ false,
+ 'isConstructor(Date.prototype.getUTCMilliseconds) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.getUTCMilliseconds();
+}, '`let date = new Date(Date.now()); new date.getUTCMilliseconds()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js
new file mode 100644
index 0000000000..5fff8c51bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.prototype.getutcmilliseconds
+description: Return value for invalid date
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, return NaN.
+---*/
+
+assert.sameValue(new Date(NaN).getUTCMilliseconds(), NaN);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js
new file mode 100644
index 0000000000..b1cf64e3b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.prototype.getutcmilliseconds
+description: >
+ Behavior when "this" value is an Object without a [[DateValue]] internal slot
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+
+ The abstract operation thisTimeValue(value) performs the following steps:
+
+ 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then
+ a. Return value.[[DateValue]].
+ 2. Throw a TypeError exception.
+---*/
+
+var getUTCMilliseconds = Date.prototype.getUTCMilliseconds;
+var args = (function() {
+ return arguments;
+}());
+
+assert.sameValue(typeof getUTCMilliseconds, 'function');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call([]);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(args);
+}, 'arguments exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js
new file mode 100644
index 0000000000..8ed9cbdc1a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.prototype.getutcmilliseconds
+description: Behavior when "this" value is not an Object
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+
+ The abstract operation thisTimeValue(value) performs the following steps:
+
+ 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then
+ a. Return value.[[DateValue]].
+ 2. Throw a TypeError exception.
+features: [Symbol]
+---*/
+
+var getUTCMilliseconds = Date.prototype.getUTCMilliseconds;
+var symbol = Symbol();
+
+assert.sameValue(typeof getUTCMilliseconds, 'function');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(0);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(true);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(undefined);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call('');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ getUTCMilliseconds.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js
new file mode 100644
index 0000000000..fdbe4b17fa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.prototype.getutcmmilliseconds
+description: Return value for valid dates
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+---*/
+
+var july6 = 1467763200000;
+
+assert.sameValue(new Date(july6).getUTCMilliseconds(), 0, 'first millisecond');
+assert.sameValue(
+ new Date(july6 - 1).getUTCMilliseconds(), 999, 'previous millisecond'
+);
+assert.sameValue(
+ new Date(july6 + 999).getUTCMilliseconds(), 999, 'final millisecond'
+);
+assert.sameValue(
+ new Date(july6 + 1000).getUTCMilliseconds(), 0, 'subsequent millisecond'
+);
+
+reportCompare(0, 0);