diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString')
11 files changed, 230 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js new file mode 100644 index 0000000000..21dd5d4411 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js @@ -0,0 +1,27 @@ +// 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 "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toLocaleTimeString; +if (x === 1) { + Date.prototype.toLocaleTimeString = 2; +} else { + Date.prototype.toLocaleTimeString = 1; +} + +assert.notSameValue( + Date.prototype.toLocaleTimeString, + x, + 'The value of Date.prototype.toLocaleTimeString 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/toLocaleTimeString/S15.9.5.7_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T2.js new file mode 100644 index 0000000000..3069df6de6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_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. + +/*--- +info: | + The Date.prototype property "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toLocaleTimeString, + false, + 'The value of delete Date.prototype.toLocaleTimeString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toLocaleTimeString'), + 'The value of !Date.prototype.hasOwnProperty(\'toLocaleTimeString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js new file mode 100644 index 0000000000..ece77abd00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_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 property "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toLocaleTimeString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toLocaleTimeString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toLocaleTimeString", 'The value of x is not "toLocaleTimeString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js new file mode 100644 index 0000000000..9db46eb034 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_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 "toLocaleTimeString" is 0 +esid: sec-date.prototype.tolocaletimestring +description: The "length" property of the "toLocaleTimeString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toLocaleTimeString.hasOwnProperty("length"), + true, + 'Date.prototype.toLocaleTimeString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toLocaleTimeString.length, + 0, + 'The value of Date.prototype.toLocaleTimeString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js new file mode 100644 index 0000000000..d0f4fbabc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_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.toLocaleTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toLocaleTimeString.length; +verifyNotWritable(Date.prototype.toLocaleTimeString, "length", null, 1); + +assert.sameValue( + Date.prototype.toLocaleTimeString.length, + x, + 'The value of Date.prototype.toLocaleTimeString.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/toLocaleTimeString/S15.9.5.7_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T2.js new file mode 100644 index 0000000000..5137a41104 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_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. + +/*--- +info: | + The Date.prototype.toLocaleTimeString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.toLocaleTimeString.length, + true, + 'The value of `delete Date.prototype.toLocaleTimeString.length` is expected to be true' +); + +assert( + !Date.prototype.toLocaleTimeString.hasOwnProperty('length'), + 'The value of !Date.prototype.toLocaleTimeString.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/toLocaleTimeString/S15.9.5.7_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T3.js new file mode 100644 index 0000000000..8e03eff9be --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_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.toLocaleTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toLocaleTimeString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toLocaleTimeString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toLocaleTimeString) { + 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/toLocaleTimeString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/browser.js diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js new file mode 100644 index 0000000000..260baf8b5d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/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.tolocaletimestring +description: > + Date.prototype.toLocaleTimeString.name is "toLocaleTimeString". +info: | + Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ] ) + + 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.toLocaleTimeString.name, "toLocaleTimeString"); + +verifyNotEnumerable(Date.prototype.toLocaleTimeString, "name"); +verifyNotWritable(Date.prototype.toLocaleTimeString, "name"); +verifyConfigurable(Date.prototype.toLocaleTimeString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js new file mode 100644 index 0000000000..6f648bb789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/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.toLocaleTimeString 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.toLocaleTimeString), + false, + 'isConstructor(Date.prototype.toLocaleTimeString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toLocaleTimeString(); +}, '`let date = new Date(Date.now()); new date.toLocaleTimeString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js |