summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/getSeconds
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/getSeconds')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js13
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js36
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js46
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js50
15 files changed, 366 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js
new file mode 100644
index 0000000000..b372371f87
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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 "getSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.getSeconds;
+if (x === 1) {
+ Date.prototype.getSeconds = 2;
+} else {
+ Date.prototype.getSeconds = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.getSeconds,
+ x,
+ 'The value of Date.prototype.getSeconds 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/getSeconds/S15.9.5.22_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js
new file mode 100644
index 0000000000..0b096b7988
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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 "getSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.getSeconds,
+ false,
+ 'The value of delete Date.prototype.getSeconds is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('getSeconds'),
+ 'The value of !Date.prototype.hasOwnProperty(\'getSeconds\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js
new file mode 100644
index 0000000000..58daf773d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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 "getSeconds" has { DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('getSeconds'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'getSeconds\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "getSeconds", 'The value of x is not "getSeconds"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js
new file mode 100644
index 0000000000..54125a0509
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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 "getSeconds" is 0
+esid: sec-date.prototype.getseconds
+description: The "length" property of the "getSeconds" is 0
+---*/
+assert.sameValue(
+ Date.prototype.getSeconds.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.getSeconds.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.getSeconds.length,
+ 0,
+ 'The value of Date.prototype.getSeconds.length is expected to be 0'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js
new file mode 100644
index 0000000000..557aa53531
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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.getSeconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.getSeconds.length;
+verifyNotWritable(Date.prototype.getSeconds, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.getSeconds.length,
+ x,
+ 'The value of Date.prototype.getSeconds.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/getSeconds/S15.9.5.22_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js
new file mode 100644
index 0000000000..cb6f6497ae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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.getSeconds property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.getSeconds.length,
+ true,
+ 'The value of `delete Date.prototype.getSeconds.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.getSeconds.hasOwnProperty('length'),
+ 'The value of !Date.prototype.getSeconds.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/getSeconds/S15.9.5.22_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js
new file mode 100644
index 0000000000..c6b40d5dba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_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.getSeconds property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.getseconds
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.getSeconds.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.getSeconds.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.getSeconds) {
+ 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/getSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js
new file mode 100644
index 0000000000..56d30ef47f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/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.getseconds
+description: >
+ Date.prototype.getSeconds.name is "getSeconds".
+info: |
+ Date.prototype.getSeconds ( )
+
+ 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.getSeconds.name, "getSeconds");
+
+verifyNotEnumerable(Date.prototype.getSeconds, "name");
+verifyNotWritable(Date.prototype.getSeconds, "name");
+verifyConfigurable(Date.prototype.getSeconds, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js
new file mode 100644
index 0000000000..cae3edd42d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/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.getSeconds 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.getSeconds),
+ false,
+ 'isConstructor(Date.prototype.getSeconds) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.getSeconds();
+}, '`let date = new Date(Date.now()); new date.getSeconds()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js
new file mode 100644
index 0000000000..6446cd025c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/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.getseconds
+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).getSeconds(), NaN);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js
new file mode 100644
index 0000000000..f3931afe03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/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.getseconds
+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 getSeconds = Date.prototype.getSeconds;
+var args = (function() {
+ return arguments;
+}());
+
+assert.sameValue(typeof getSeconds, 'function');
+
+assert.throws(TypeError, function() {
+ getSeconds.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ getSeconds.call([]);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(args);
+}, 'arguments exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js
new file mode 100644
index 0000000000..cc754be716
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/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.getseconds
+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 getSeconds = Date.prototype.getSeconds;
+var symbol = Symbol();
+
+assert.sameValue(typeof getSeconds, 'function');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(0);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(true);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(undefined);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ getSeconds.call('');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ getSeconds.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js
new file mode 100644
index 0000000000..3bddccc6c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js
@@ -0,0 +1,50 @@
+// 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.getseconds
+description: Return value for valid dates
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(LocalTime(t)).
+---*/
+
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 30).getSeconds(),
+ 30,
+ 'first millisecond'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 30, -1).getSeconds(), 29, 'previous millisecond'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 30, 999).getSeconds(), 30, 'final millisecond'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 30, 1000).getSeconds(),
+ 31,
+ 'subsequent millisecond'
+);
+
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 59).getSeconds(),
+ 59,
+ 'first millisecond (minute boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 59, -1).getSeconds(),
+ 58,
+ 'previous millisecond (minute boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 59, 999).getSeconds(),
+ 59,
+ 'final millisecond (minute boundary)'
+);
+assert.sameValue(
+ new Date(2016, 6, 6, 14, 16, 59, 1000).getSeconds(),
+ 0,
+ 'subsequent millisecond (minute boundary)'
+);
+
+reportCompare(0, 0);