summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/getUTCHours
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/getUTCHours')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js13
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js36
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js46
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js44
15 files changed, 360 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js
new file mode 100644
index 0000000000..c3dc2fec3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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 "getUTCHours" has { DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.getUTCHours;
+if (x === 1) {
+ Date.prototype.getUTCHours = 2;
+} else {
+ Date.prototype.getUTCHours = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.getUTCHours,
+ x,
+ 'The value of Date.prototype.getUTCHours 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/getUTCHours/S15.9.5.19_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js
new file mode 100644
index 0000000000..391e4c9ae6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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 "getUTCHours" has { DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.getUTCHours,
+ false,
+ 'The value of delete Date.prototype.getUTCHours is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('getUTCHours'),
+ 'The value of !Date.prototype.hasOwnProperty(\'getUTCHours\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js
new file mode 100644
index 0000000000..881e02a43a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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 "getUTCHours" has { DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('getUTCHours'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCHours\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "getUTCHours", 'The value of x is not "getUTCHours"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js
new file mode 100644
index 0000000000..8fc7619ec2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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 "getUTCHours" is 0
+esid: sec-date.prototype.getutchours
+description: The "length" property of the "getUTCHours" is 0
+---*/
+assert.sameValue(
+ Date.prototype.getUTCHours.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.getUTCHours.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.getUTCHours.length,
+ 0,
+ 'The value of Date.prototype.getUTCHours.length is expected to be 0'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js
new file mode 100644
index 0000000000..17c8d64a95
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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.getUTCHours property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.getUTCHours.length;
+verifyNotWritable(Date.prototype.getUTCHours, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.getUTCHours.length,
+ x,
+ 'The value of Date.prototype.getUTCHours.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/getUTCHours/S15.9.5.19_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js
new file mode 100644
index 0000000000..b7bbcdcfdb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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.getUTCHours property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.getUTCHours.length,
+ true,
+ 'The value of `delete Date.prototype.getUTCHours.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.getUTCHours.hasOwnProperty('length'),
+ 'The value of !Date.prototype.getUTCHours.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/getUTCHours/S15.9.5.19_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js
new file mode 100644
index 0000000000..d56f7edbef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_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.getUTCHours property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getutchours
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.getUTCHours.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.getUTCHours.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.getUTCHours) {
+ 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/getUTCHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js
new file mode 100644
index 0000000000..d35e74baa5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/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.getutchours
+description: >
+ Date.prototype.getUTCHours.name is "getUTCHours".
+info: |
+ Date.prototype.getUTCHours ( )
+
+ 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.getUTCHours.name, "getUTCHours");
+
+verifyNotEnumerable(Date.prototype.getUTCHours, "name");
+verifyNotWritable(Date.prototype.getUTCHours, "name");
+verifyConfigurable(Date.prototype.getUTCHours, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js
new file mode 100644
index 0000000000..60ed6e667f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/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.getUTCHours 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.getUTCHours),
+ false,
+ 'isConstructor(Date.prototype.getUTCHours) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.getUTCHours();
+}, '`let date = new Date(Date.now()); new date.getUTCHours()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js
new file mode 100644
index 0000000000..435093209c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/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.getutchours
+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).getUTCHours(), NaN);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js
new file mode 100644
index 0000000000..1158d6a6ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/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.getutchours
+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 getUTCHours = Date.prototype.getUTCHours;
+var args = (function() {
+ return arguments;
+}());
+
+assert.sameValue(typeof getUTCHours, 'function');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call([]);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(args);
+}, 'arguments exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js
new file mode 100644
index 0000000000..fea152d46a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/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.getutchours
+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 getUTCHours = Date.prototype.getUTCHours;
+var symbol = Symbol();
+
+assert.sameValue(typeof getUTCHours, 'function');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(0);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(true);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(undefined);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call('');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ getUTCHours.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js
new file mode 100644
index 0000000000..19157cf787
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js
@@ -0,0 +1,44 @@
+// 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.getutchours
+description: Return value for valid dates
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(t).
+---*/
+
+var hour15 = 1467817200000;
+var hour23 = 1467846000000;
+var hourMs = 60 * 60 * 1000;
+
+assert.sameValue(new Date(hour15).getUTCHours(), 15, 'first millisecond');
+assert.sameValue(
+ new Date(hour15 - 1).getUTCHours(), 14, 'previous millisecond'
+);
+assert.sameValue(
+ new Date(hour15 + hourMs - 1).getUTCHours(), 15, 'final millisecond'
+);
+assert.sameValue(
+ new Date(hour15 + hourMs).getUTCHours(), 16, 'subsequent millisecond'
+);
+
+assert.sameValue(
+ new Date(hour23).getUTCHours(), 23, 'first millisecond (day boundary)'
+);
+assert.sameValue(
+ new Date(hour23 - 1).getUTCHours(), 22, 'previous millisecond (day boundary)'
+);
+assert.sameValue(
+ new Date(hour23 + hourMs - 1).getUTCHours(),
+ 23,
+ 'final millisecond (day boundary)'
+);
+assert.sameValue(
+ new Date(hour23 + hourMs).getUTCHours(),
+ 0,
+ 'subsequent millisecond (day boundary)'
+);
+
+reportCompare(0, 0);