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/toTimeString/S15.9.5.4_A1_T1.js | 25 ++++++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A1_T2.js | 23 ++++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A1_T3.js | 20 +++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A2_T1.js | 22 ++++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T1.js | 24 +++++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T2.js | 24 +++++++++++++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T3.js | 22 ++++++++++++++ .../Date/prototype/toTimeString/browser.js | 0 .../Date/prototype/toTimeString/format.js | 17 +++++++++++ .../Date/prototype/toTimeString/invalid-date.js | 17 +++++++++++ .../built-ins/Date/prototype/toTimeString/name.js | 28 +++++++++++++++++ .../prototype/toTimeString/not-a-constructor.js | 35 ++++++++++++++++++++++ .../built-ins/Date/prototype/toTimeString/shell.js | 0 13 files changed, 257 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/toTimeString') diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js new file mode 100644 index 0000000000..4b2913c51f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_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 "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toTimeString; +if (x === 1) { + Date.prototype.toTimeString = 2; +} else { + Date.prototype.toTimeString = 1; +} + +assert.notSameValue( + Date.prototype.toTimeString, + x, + 'The value of Date.prototype.toTimeString 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/toTimeString/S15.9.5.4_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js new file mode 100644 index 0000000000..8a9830dd56 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.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. + +/*--- +info: The Date.prototype property "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toTimeString, + false, + 'The value of delete Date.prototype.toTimeString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toTimeString'), + 'The value of !Date.prototype.hasOwnProperty(\'toTimeString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js new file mode 100644 index 0000000000..c6a0aa0e02 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_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 "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toTimeString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toTimeString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toTimeString", 'The value of x is not "toTimeString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js new file mode 100644 index 0000000000..2d8c9676f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.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 "length" property of the "toTimeString" is 0 +esid: sec-date.prototype.totimestring +description: The "length" property of the "toTimeString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toTimeString.hasOwnProperty("length"), + true, + 'Date.prototype.toTimeString.hasOwnProperty("length") must return true' +); + + +assert.sameValue( + Date.prototype.toTimeString.length, + 0, + 'The value of Date.prototype.toTimeString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js new file mode 100644 index 0000000000..8337e86cbf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_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.toTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toTimeString.length; +verifyNotWritable(Date.prototype.toTimeString, "length", null, 1); + +assert.sameValue( + Date.prototype.toTimeString.length, + x, + 'The value of Date.prototype.toTimeString.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/toTimeString/S15.9.5.4_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js new file mode 100644 index 0000000000..27c8d06ee0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_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.toTimeString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.toTimeString.length, + true, + 'The value of `delete Date.prototype.toTimeString.length` is expected to be true' +); + +assert( + !Date.prototype.toTimeString.hasOwnProperty('length'), + 'The value of !Date.prototype.toTimeString.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/toTimeString/S15.9.5.4_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js new file mode 100644 index 0000000000..ef6033fcc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_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.toTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toTimeString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toTimeString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toTimeString) { + 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/toTimeString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js new file mode 100644 index 0000000000..a00923a27a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.totimestring +description: Test the format of the time from toTimeString +info: | + Date.prototype.toTimeString ( ) + + 5. Return the String value formed by concatenating TimeString(_t_) and TimeZoneString(_tv_). +---*/ + +let timeRegExp = /^[0-9]{2}:[0-9]{2}:[0-9]{2} GMT[+-][0-9]{4}( \(.+\))?$/ +let match = timeRegExp.exec(new Date().toTimeString()); +assert.notSameValue(null, match); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js new file mode 100644 index 0000000000..58e9ebd515 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.totimestring +description: Invalid Dates are rendered as "Invalid Date" +info: | + Date.prototype.toTimeString ( ) + + ... + 3. If tv is NaN, return "Invalid Date". + ... +---*/ + +assert.sameValue(new Date(NaN).toTimeString(), "Invalid Date"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js new file mode 100644 index 0000000000..4616efbad2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/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.totimestring +description: > + Date.prototype.toTimeString.name is "toTimeString". +info: | + Date.prototype.toTimeString ( ) + + 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.toTimeString.name, "toTimeString"); + +verifyNotEnumerable(Date.prototype.toTimeString, "name"); +verifyNotWritable(Date.prototype.toTimeString, "name"); +verifyConfigurable(Date.prototype.toTimeString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js new file mode 100644 index 0000000000..7191049f7c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/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.toTimeString 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.toTimeString), + false, + 'isConstructor(Date.prototype.toTimeString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toTimeString(); +}, '`let date = new Date(Date.now()); new date.toTimeString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3