From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../prototype/getUTCSeconds/S15.9.5.23_A1_T1.js | 25 ++++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A1_T2.js | 22 +++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A1_T3.js | 20 ++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A2_T1.js | 21 ++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T1.js | 24 +++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T2.js | 24 +++++++++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T3.js | 22 +++++++++++ .../Date/prototype/getUTCSeconds/browser.js | 0 .../built-ins/Date/prototype/getUTCSeconds/name.js | 28 +++++++++++++ .../prototype/getUTCSeconds/not-a-constructor.js | 35 ++++++++++++++++ .../Date/prototype/getUTCSeconds/shell.js | 0 .../getUTCSeconds/this-value-invalid-date.js | 13 ++++++ .../prototype/getUTCSeconds/this-value-non-date.js | 36 +++++++++++++++++ .../getUTCSeconds/this-value-non-object.js | 46 ++++++++++++++++++++++ .../getUTCSeconds/this-value-valid-date.js | 45 +++++++++++++++++++++ 15 files changed, 361 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds') diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js new file mode 100644 index 0000000000..85b6e8fc61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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 "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCSeconds; +if (x === 1) { + Date.prototype.getUTCSeconds = 2; +} else { + Date.prototype.getUTCSeconds = 1; +} + +assert.notSameValue( + Date.prototype.getUTCSeconds, + x, + 'The value of Date.prototype.getUTCSeconds 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/getUTCSeconds/S15.9.5.23_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js new file mode 100644 index 0000000000..fb718d5d2c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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 "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCSeconds, + false, + 'The value of delete Date.prototype.getUTCSeconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCSeconds'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCSeconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js new file mode 100644 index 0000000000..98e0d3a302 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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 "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCSeconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCSeconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCSeconds", 'The value of x is not "getUTCSeconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js new file mode 100644 index 0000000000..ab2c4c4c93 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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 "getUTCSeconds" is 0 +esid: sec-date.prototype.getutcseconds +description: The "length" property of the "getUTCSeconds" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCSeconds.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCSeconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCSeconds.length, + 0, + 'The value of Date.prototype.getUTCSeconds.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js new file mode 100644 index 0000000000..fdce7234f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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.getUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCSeconds.length; +verifyNotWritable(Date.prototype.getUTCSeconds, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCSeconds.length, + x, + 'The value of Date.prototype.getUTCSeconds.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/getUTCSeconds/S15.9.5.23_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js new file mode 100644 index 0000000000..45a794334f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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.getUTCSeconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCSeconds.length, + true, + 'The value of `delete Date.prototype.getUTCSeconds.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCSeconds.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCSeconds.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/getUTCSeconds/S15.9.5.23_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js new file mode 100644 index 0000000000..fc43b2b266 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_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.getUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCSeconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCSeconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCSeconds) { + 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/getUTCSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js new file mode 100644 index 0000000000..11cdea38b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/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.getutcseconds +description: > + Date.prototype.getUTCSeconds.name is "getUTCSeconds". +info: | + Date.prototype.getUTCSeconds ( ) + + 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.getUTCSeconds.name, "getUTCSeconds"); + +verifyNotEnumerable(Date.prototype.getUTCSeconds, "name"); +verifyNotWritable(Date.prototype.getUTCSeconds, "name"); +verifyConfigurable(Date.prototype.getUTCSeconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js new file mode 100644 index 0000000000..be8ed19fe1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/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.getUTCSeconds 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.getUTCSeconds), + false, + 'isConstructor(Date.prototype.getUTCSeconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCSeconds(); +}, '`let date = new Date(Date.now()); new date.getUTCSeconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js new file mode 100644 index 0000000000..98403f3bd7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/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.getutcseconds +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).getUTCSeconds(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js new file mode 100644 index 0000000000..d14a9885fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/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.getutcseconds +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 getUTCSeconds = Date.prototype.getUTCSeconds; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCSeconds, 'function'); + +assert.throws(TypeError, function() { + getUTCSeconds.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCSeconds.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js new file mode 100644 index 0000000000..575fe16b64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/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.getutcseconds +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 getUTCSeconds = Date.prototype.getUTCSeconds; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCSeconds, 'function'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js new file mode 100644 index 0000000000..5851451eea --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js @@ -0,0 +1,45 @@ +// 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.getutcseconds +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return SecFromTime(t). +---*/ + +var sec34 = 1467819394000; +var sec59 = 1467819419000; + +assert.sameValue(new Date(sec34).getUTCSeconds(), 34, 'first millisecond'); +assert.sameValue( + new Date(sec34 - 1).getUTCSeconds(), 33, 'previous millisecond' +); +assert.sameValue( + new Date(sec34 + 999).getUTCSeconds(), 34, 'final millisecond' +); +assert.sameValue( + new Date(sec34 + 1000).getUTCSeconds(), 35, 'subsequent millisecond' +); + +assert.sameValue( + new Date(sec59).getUTCSeconds(), 59, 'first millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 - 1).getUTCSeconds(), + 58, + 'previous millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 + 99).getUTCSeconds(), + 59, + 'final millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 + 1000).getUTCSeconds(), + 0, + 'subsequent millisecond (minute boundary)' +); + +reportCompare(0, 0); -- cgit v1.2.3