summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/getHours
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/getHours')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js26
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js19
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js18
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js23
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js13
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js36
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js46
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js46
15 files changed, 361 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js
new file mode 100644
index 0000000000..b5d567e82b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.gethours
+info: The Date.prototype property "getHours" has { DontEnum } attributes
+es5id: 15.9.5.18_A1_T1
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.getHours;
+if (x === 1) {
+ Date.prototype.getHours = 2;
+} else {
+ Date.prototype.getHours = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.getHours,
+ x,
+ 'The value of Date.prototype.getHours 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/getHours/S15.9.5.18_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js
new file mode 100644
index 0000000000..6db2368458
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.gethours
+info: The Date.prototype property "getHours" has { DontEnum } attributes
+es5id: 15.9.5.18_A1_T2
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(delete Date.prototype.getHours, false, 'The value of delete Date.prototype.getHours is not false');
+
+assert(
+ !Date.prototype.hasOwnProperty('getHours'),
+ 'The value of !Date.prototype.hasOwnProperty(\'getHours\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js
new file mode 100644
index 0000000000..2e4a4cb504
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.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.
+
+/*---
+esid: sec-date.prototype.gethours
+info: The Date.prototype property "getHours" has { DontEnum } attributes
+es5id: 15.9.5.18_A1_T3
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('getHours'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'getHours\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "getHours", 'The value of x is not "getHours"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js
new file mode 100644
index 0000000000..7a10e7fa70
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.gethours
+info: The "length" property of the "getHours" is 0
+es5id: 15.9.5.18_A2_T1
+description: The "length" property of the "getHours" is 0
+---*/
+assert.sameValue(
+ Date.prototype.getHours.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.getHours.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(Date.prototype.getHours.length, 0, 'The value of Date.prototype.getHours.length is expected to be 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js
new file mode 100644
index 0000000000..91895b2dc4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_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.
+
+/*---
+esid: sec-date.prototype.gethours
+info: |
+ The Date.prototype.getHours property "length" has { ReadOnly, DontDelete,
+ DontEnum } attributes
+es5id: 15.9.5.18_A3_T1
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.getHours.length;
+verifyNotWritable(Date.prototype.getHours, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.getHours.length,
+ x,
+ 'The value of Date.prototype.getHours.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/getHours/S15.9.5.18_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js
new file mode 100644
index 0000000000..39c306667f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.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.
+
+/*---
+esid: sec-date.prototype.gethours
+info: |
+ The Date.prototype.getHours property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+es5id: 15.9.5.18_A3_T2
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.getHours.length,
+ true,
+ 'The value of `delete Date.prototype.getHours.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.getHours.hasOwnProperty('length'),
+ 'The value of !Date.prototype.getHours.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/getHours/S15.9.5.18_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js
new file mode 100644
index 0000000000..10d0865799
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.gethours
+info: |
+ The Date.prototype.getHours property "length" has { ReadOnly, DontDelete,
+ DontEnum } attributes
+es5id: 15.9.5.18_A3_T3
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.getHours.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.getHours.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.getHours) {
+ 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/getHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/name.js
new file mode 100644
index 0000000000..b775ade1e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/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.gethours
+description: >
+ Date.prototype.getHours.name is "getHours".
+info: |
+ Date.prototype.getHours ( )
+
+ 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.getHours.name, "getHours");
+
+verifyNotEnumerable(Date.prototype.getHours, "name");
+verifyNotWritable(Date.prototype.getHours, "name");
+verifyConfigurable(Date.prototype.getHours, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js
new file mode 100644
index 0000000000..bdb019bbee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/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.getHours 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.getHours),
+ false,
+ 'isConstructor(Date.prototype.getHours) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.getHours();
+}, '`let date = new Date(Date.now()); new date.getHours()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js
new file mode 100644
index 0000000000..6d27ad3309
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/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.gethours
+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).getHours(), NaN);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js
new file mode 100644
index 0000000000..57ec097430
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/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.gethours
+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 getHours = Date.prototype.getHours;
+var args = (function() {
+ return arguments;
+}());
+
+assert.sameValue(typeof getHours, 'function');
+
+assert.throws(TypeError, function() {
+ getHours.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ getHours.call([]);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ getHours.call(args);
+}, 'arguments exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js
new file mode 100644
index 0000000000..772af36457
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/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.gethours
+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 getHours = Date.prototype.getHours;
+var symbol = Symbol();
+
+assert.sameValue(typeof getHours, 'function');
+
+assert.throws(TypeError, function() {
+ getHours.call(0);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ getHours.call(true);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ getHours.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ getHours.call(undefined);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ getHours.call('');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ getHours.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js
new file mode 100644
index 0000000000..105e1434b0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.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.gethours
+description: Return value for valid dates
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(LocalTime(t)).
+---*/
+
+assert.sameValue(new Date(2016, 6, 6, 13).getHours(), 13, 'first millisecond');
+assert.sameValue(
+ new Date(2016, 6, 6, 13, 0, 0, -1).getHours(), 12, 'previous millisecond'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 13, 59, 59, 999).getHours(),
+ 13,
+ 'final millisecond'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 13, 59, 59, 1000).getHours(),
+ 14,
+ 'subsequent millisecond'
+);
+
+assert.sameValue(
+ new Date(2016, 6, 6, 23).getHours(), 23, 'first millisecond (hour boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 23, 0, 0, -1).getHours(),
+ 22,
+ 'previous millisecond (hour boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 23, 59, 59, 999).getHours(),
+ 23,
+ 'final millisecond (hour boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 23, 59, 59, 1000).getHours(),
+ 0,
+ 'subsequent millisecond (hour boundary)'
+);
+
+reportCompare(0, 0);