summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/parse
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/Date/parse
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/parse')
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T1.js19
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T2.js18
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A2_T1.js18
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T1.js19
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T2.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/time-value-maximum-range.js41
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/without-utc-offset.js19
-rw-r--r--js/src/tests/test262/built-ins/Date/parse/zero.js32
14 files changed, 287 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T1.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T1.js
new file mode 100644
index 0000000000..eb110ddee3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T1.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.
+
+/*---
+info: The Date property "parse" has { DontEnum } attributes
+esid: sec-date.parse
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.parse;
+if (x === 1)
+ Date.parse = 2;
+else
+ Date.parse = 1;
+if (Date.parse === x) {
+ $ERROR('#1: The Date.parse has not the attribute ReadOnly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T2.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T2.js
new file mode 100644
index 0000000000..c1e1597569
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T2.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.
+
+/*---
+info: The Date property "parse" has { DontEnum } attributes
+esid: sec-date.parse
+description: Checking absence of DontDelete attribute
+---*/
+
+if (delete Date.parse === false) {
+ $ERROR('#1: The Date.parse property has not the attributes DontDelete');
+}
+
+if (Date.hasOwnProperty('parse')) {
+ $ERROR('#2: The Date.parse property has not the attributes DontDelete');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T3.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A1_T3.js
new file mode 100644
index 0000000000..67a747d8c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_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 property "parse" has { DontEnum } attributes
+esid: sec-date.parse
+description: Checking DontEnum attribute
+---*/
+
+if (Date.propertyIsEnumerable('parse')) {
+ $ERROR('#1: The Date.parse property has the attribute DontEnum');
+}
+
+for (var x in Date) {
+ if (x === "parse") {
+ $ERROR('#2: The Date.parse has the attribute DontEnum');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A2_T1.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A2_T1.js
new file mode 100644
index 0000000000..c33f7de9bf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_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.
+
+/*---
+info: The "length" property of the "parse" is 1
+esid: sec-date.parse
+description: The "length" property of the "parse" is 1
+---*/
+
+if (Date.parse.hasOwnProperty("length") !== true) {
+ $ERROR('#1: The parse has a "length" property');
+}
+
+if (Date.parse.length !== 1) {
+ $ERROR('#2: The "length" property of the parse is 1');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T1.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T1.js
new file mode 100644
index 0000000000..d6d8acc734
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T1.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.
+
+/*---
+info: |
+ The Date.parse property "length" has { ReadOnly, DontDelete, DontEnum }
+ attributes
+esid: sec-date.parse
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.parse.length;
+verifyNotWritable(Date.parse, "length", null, 1);
+if (Date.parse.length !== x) {
+ $ERROR('#1: The Date.parse.length has the attribute ReadOnly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T2.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T2.js
new file mode 100644
index 0000000000..27b3840717
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T2.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.parse property "length" has { ReadOnly, ! DontDelete, DontEnum }
+ attributes
+esid: sec-date.parse
+description: Checking DontDelete attribute
+---*/
+
+if (delete Date.parse.length !== true) {
+ $ERROR('#1: The Date.parse.length property does not have the attributes DontDelete');
+}
+
+if (Date.parse.hasOwnProperty('length')) {
+ $ERROR('#2: The Date.parse.length property does not have the attributes DontDelete');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T3.js b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_A3_T3.js
new file mode 100644
index 0000000000..079a42e7bf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/S15.9.4.2_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.parse property "length" has { ReadOnly, DontDelete, DontEnum }
+ attributes
+esid: sec-date.parse
+description: Checking DontEnum attribute
+---*/
+
+if (Date.parse.propertyIsEnumerable('length')) {
+ $ERROR('#1: The Date.parse.length property has the attribute DontEnum');
+}
+
+for (var x in Date.parse) {
+ if (x === "length") {
+ $ERROR('#2: The Date.parse.length has the attribute DontEnum');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/browser.js b/js/src/tests/test262/built-ins/Date/parse/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/parse/name.js b/js/src/tests/test262/built-ins/Date/parse/name.js
new file mode 100644
index 0000000000..79595c22f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/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.parse
+description: >
+ Date.parse.name is "parse".
+info: |
+ Date.parse ( string )
+
+ 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.parse.name, "parse");
+
+verifyNotEnumerable(Date.parse, "name");
+verifyNotWritable(Date.parse, "name");
+verifyConfigurable(Date.parse, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/parse/not-a-constructor.js
new file mode 100644
index 0000000000..01551a621c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/not-a-constructor.js
@@ -0,0 +1,31 @@
+// 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.parse 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.parse), false, 'isConstructor(Date.parse) must return false');
+
+assert.throws(TypeError, () => {
+ new Date.parse();
+}, '`new Date.parse()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/shell.js b/js/src/tests/test262/built-ins/Date/parse/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/parse/time-value-maximum-range.js b/js/src/tests/test262/built-ins/Date/parse/time-value-maximum-range.js
new file mode 100644
index 0000000000..9dffe30587
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/time-value-maximum-range.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2018 Andrew Paprocki. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.parse
+description: >
+ Date.parse return value is limited to specified time value maximum range
+info: |
+ Date.parse ( string )
+
+ parse interprets the resulting String as a date and time; it returns a
+ Number, the UTC time value corresponding to the date and time.
+
+ A Date object contains a Number indicating a particular instant in time to
+ within a millisecond. Such a Number is called a time value.
+
+ The actual range of times supported by ECMAScript Date objects is slightly
+ smaller: exactly -100,000,000 days to 100,000,000 days measured relative to
+ midnight at the beginning of 01 January, 1970 UTC. This gives a range of
+ 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC.
+---*/
+
+const minDateStr = "-271821-04-20T00:00:00.000Z";
+const minDate = new Date(-8640000000000000);
+
+assert.sameValue(minDate.toISOString(), minDateStr, "minDateStr");
+assert.sameValue(Date.parse(minDateStr), minDate.valueOf(), "parse minDateStr");
+
+const maxDateStr = "+275760-09-13T00:00:00.000Z";
+const maxDate = new Date(8640000000000000);
+
+assert.sameValue(maxDate.toISOString(), maxDateStr, "maxDateStr");
+assert.sameValue(Date.parse(maxDateStr), maxDate.valueOf(), "parse maxDateStr");
+
+const belowRange = "-271821-04-19T23:59:59.999Z";
+const aboveRange = "+275760-09-13T00:00:00.001Z";
+
+assert.sameValue(Date.parse(belowRange), NaN, "parse below minimum time value");
+assert.sameValue(Date.parse(aboveRange), NaN, "parse above maximum time value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/without-utc-offset.js b/js/src/tests/test262/built-ins/Date/parse/without-utc-offset.js
new file mode 100644
index 0000000000..dbe0fbab7c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/without-utc-offset.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-date.parse
+description: >
+ Offsetless date-time strings are local time, offsetless date-only strings are UTC time
+info: |
+ Date.parse ( string )
+
+ When the UTC offset representation is absent, date-only forms are interpreted
+ as a UTC time and date-time forms are interpreted as a local time.
+---*/
+
+const timezoneOffsetMS = new Date(0).getTimezoneOffset() * 60000;
+
+assert.sameValue(Date.parse('1970-01-01T00:00:00'), timezoneOffsetMS);
+assert.sameValue(Date.parse('1970-01-01'), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/parse/zero.js b/js/src/tests/test262/built-ins/Date/parse/zero.js
new file mode 100644
index 0000000000..5e7e7c0e87
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/parse/zero.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2018 Andrew Paprocki. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.parse
+description: >
+ Date.parse of toString/toUTCString/toISOString of zero value is zero
+info: |
+ Date.parse ( string )
+
+ If x is any Date object whose milliseconds amount is zero within a
+ particular implementation of ECMAScript, then all of the following
+ expressions should produce the same numeric value in that
+ implementation, if all the properties referenced have their initial
+ values:
+
+ x.valueOf()
+ Date.parse(x.toString())
+ Date.parse(x.toUTCString())
+ Date.parse(x.toISOString())
+---*/
+
+const zero = new Date(0);
+
+assert.sameValue(zero.valueOf(), Date.parse(zero.toString()),
+ "Date.parse(zeroDate.toString())");
+assert.sameValue(zero.valueOf(), Date.parse(zero.toUTCString()),
+ "Date.parse(zeroDate.toUTCString())");
+assert.sameValue(zero.valueOf(), Date.parse(zero.toISOString()),
+ "Date.parse(zeroDate.toISOString())");
+
+reportCompare(0, 0);