From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../Date/prototype/toISOString/15.9.5.43-0-10.js | 29 ++++++++++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-11.js | 20 +++++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-12.js | 20 +++++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-13.js | 17 +++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-14.js | 16 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-15.js | 16 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-16.js | 17 +++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-2.js | 13 ++++++++ .../Date/prototype/toISOString/15.9.5.43-0-3.js | 11 +++++++ .../Date/prototype/toISOString/15.9.5.43-0-4.js | 16 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-5.js | 15 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-6.js | 16 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-7.js | 16 ++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-8.js | 24 +++++++++++++++ .../Date/prototype/toISOString/15.9.5.43-0-9.js | 29 ++++++++++++++++++ .../Date/prototype/toISOString/browser.js | 0 .../built-ins/Date/prototype/toISOString/name.js | 28 +++++++++++++++++ .../prototype/toISOString/not-a-constructor.js | 35 ++++++++++++++++++++++ .../built-ins/Date/prototype/toISOString/shell.js | 0 19 files changed, 338 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/toISOString') diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js new file mode 100644 index 0000000000..44733d6b40 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, -99999999, 0, 0, 0, 1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, 1); + + assert.throws(RangeError, function() { + date.toISOString(); + }); +} else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 1); + + dateStr = date.toISOString(); + + assert.sameValue(dateStr[dateStr.length - 1], "Z"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js new file mode 100644 index 0000000000..46cf645f0b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, 100000001, 0, 0, 0, -1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +date = new Date(1970, 0, 100000001, 0, 0 + timeZoneMinutes - 60, 0, -1); +dateStr = date.toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js new file mode 100644 index 0000000000..68a07d2130 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, 100000001, 0, 0, 0, 0), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +date = new Date(1970, 0, 100000001, 0, 0 + timeZoneMinutes - 60, 0, 0); +dateStr = date.toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js new file mode 100644 index 0000000000..c2a7c4b128 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is thrown when value of + date is outside the valid range of time. +---*/ + +// As specified in ES5 15.9.1.14, time > 8.64e15 is not in the valid range. +var date = new Date(8.64e15 + 1); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js new file mode 100644 index 0000000000..14e06ce204 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - when value of year is -Infinity + Date.prototype.toISOString throw the RangeError +---*/ + +var date = new Date(-Infinity, 1, 70, 0, 0, 0); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js new file mode 100644 index 0000000000..2c35e8eb5f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - value of year is Infinity + Date.prototype.toISOString throw the RangeError +---*/ + +var date = new Date(Infinity, 1, 70, 0, 0, 0); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js new file mode 100644 index 0000000000..57d3077101 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - when this is a String object that + value format is 'YYYY-MM-DDTHH:mm:ss.sssZ' + Date.prototype.toISOString throw the TypeError +---*/ + +var date = new String("1970-01-00000:00:00.000Z"); +assert.throws(TypeError, function() { + Date.prototype.toISOString.call(date); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js new file mode 100644 index 0000000000..796769d5eb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString must exist as a function taking 0 + parameters +---*/ + +assert.sameValue(Date.prototype.toISOString.length, 0, 'Date.prototype.toISOString.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js new file mode 100644 index 0000000000..d14ec10718 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: Date.prototype.toISOString must exist as a function +---*/ + +assert.sameValue(typeof(Date.prototype.toISOString), "function", 'typeof (Date.prototype.toISOString)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js new file mode 100644 index 0000000000..14262310a7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - format of returned string is + 'YYYY-MM-DDTHH:mm:ss.sssZ', the time zone is UTC(0) +---*/ + +var date = new Date(1999, 9, 10, 10, 10, 10, 10); +var localDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000); + +assert.sameValue(localDate.toISOString(), "1999-10-10T10:10:10.010Z", 'localDate.toISOString()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js new file mode 100644 index 0000000000..e8aa9da25a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - The returned string is the UTC time + zone(0) +---*/ + +var dateStr = (new Date()).toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js new file mode 100644 index 0000000000..45a331da2d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - TypeError is thrown when this is any + other objects instead of Date object +---*/ + + +assert.throws(TypeError, function() { + Date.prototype.toISOString.call([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js new file mode 100644 index 0000000000..ca39dde06a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - TypeError is thrown when this is any + primitive values +---*/ + + +assert.throws(TypeError, function() { + Date.prototype.toISOString.call(15); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js new file mode 100644 index 0000000000..9ee9f39c9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is thrown when value of + date is Date(1970, 0, -99999999, 0, 0, 0, -1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; +assert.throws(RangeError, function() { + if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, -1); + } else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes - 60, 0, -1); + } + + dateStr = date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js new file mode 100644 index 0000000000..1dd2bd9875 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, -99999999, 0, 0, 0, 0), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, 0); + + assert.throws(RangeError, function() { + date.toISOString(); + }); +} else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 0); + + dateStr = date.toISOString(); + + assert.sameValue(dateStr[dateStr.length - 1], "Z"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js new file mode 100644 index 0000000000..1abb089310 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/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.toisostring +description: > + Date.prototype.toISOString.name is "toISOString". +info: | + Date.prototype.toISOString ( ) + + 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.toISOString.name, "toISOString"); + +verifyNotEnumerable(Date.prototype.toISOString, "name"); +verifyNotWritable(Date.prototype.toISOString, "name"); +verifyConfigurable(Date.prototype.toISOString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js new file mode 100644 index 0000000000..a3dd9891ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/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.toISOString 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.toISOString), + false, + 'isConstructor(Date.prototype.toISOString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toISOString(); +}, '`let date = new Date(Date.now()); new date.toISOString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3