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/getUTCDay/S15.9.5.17_A1_T1.js | 25 ++++++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js | 18 +++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js | 20 ++++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js | 21 ++++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js | 24 +++++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js | 24 +++++++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js | 22 +++++++++++ .../built-ins/Date/prototype/getUTCDay/browser.js | 0 .../built-ins/Date/prototype/getUTCDay/name.js | 28 +++++++++++++ .../Date/prototype/getUTCDay/not-a-constructor.js | 35 ++++++++++++++++ .../built-ins/Date/prototype/getUTCDay/shell.js | 0 .../prototype/getUTCDay/this-value-invalid-date.js | 13 ++++++ .../prototype/getUTCDay/this-value-non-date.js | 36 +++++++++++++++++ .../prototype/getUTCDay/this-value-non-object.js | 46 ++++++++++++++++++++++ .../prototype/getUTCDay/this-value-valid-date.js | 44 +++++++++++++++++++++ 15 files changed, 356 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/getUTCDay') diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js new file mode 100644 index 0000000000..cd9b0ff287 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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 "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCDay; +if (x === 1) { + Date.prototype.getUTCDay = 2; +} else { + Date.prototype.getUTCDay = 1; +} + +assert.notSameValue( + Date.prototype.getUTCDay, + x, + 'The value of Date.prototype.getUTCDay 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/getUTCDay/S15.9.5.17_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js new file mode 100644 index 0000000000..8863c901e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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.prototype property "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getUTCDay, false, 'The value of delete Date.prototype.getUTCDay is not false'); + +assert( + !Date.prototype.hasOwnProperty('getUTCDay'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCDay\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js new file mode 100644 index 0000000000..4b29c9feef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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 "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCDay'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCDay\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCDay", 'The value of x is not "getUTCDay"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js new file mode 100644 index 0000000000..c99eb6aedc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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 "getUTCDay" is 0 +esid: sec-date.prototype.getutcdaty +description: The "length" property of the "getUTCDay" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCDay.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCDay.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCDay.length, + 0, + 'The value of Date.prototype.getUTCDay.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js new file mode 100644 index 0000000000..cdfc659d5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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.getUTCDay property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCDay.length; +verifyNotWritable(Date.prototype.getUTCDay, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCDay.length, + x, + 'The value of Date.prototype.getUTCDay.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/getUTCDay/S15.9.5.17_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js new file mode 100644 index 0000000000..0ba6464b61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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.getUTCDay property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCDay.length, + true, + 'The value of `delete Date.prototype.getUTCDay.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCDay.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCDay.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/getUTCDay/S15.9.5.17_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js new file mode 100644 index 0000000000..42c7b12a6d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_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.getUTCDay property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCDay.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCDay.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCDay) { + 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/getUTCDay/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js new file mode 100644 index 0000000000..280b83ed76 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/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.getutcdaty +description: > + Date.prototype.getUTCDay.name is "getUTCDay". +info: | + Date.prototype.getUTCDay ( ) + + 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.getUTCDay.name, "getUTCDay"); + +verifyNotEnumerable(Date.prototype.getUTCDay, "name"); +verifyNotWritable(Date.prototype.getUTCDay, "name"); +verifyConfigurable(Date.prototype.getUTCDay, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js new file mode 100644 index 0000000000..42d0a20852 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/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.getUTCDay 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.getUTCDay), + false, + 'isConstructor(Date.prototype.getUTCDay) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCDay(); +}, '`let date = new Date(Date.now()); new date.getUTCDay()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js new file mode 100644 index 0000000000..5db81078d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/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.getutcday +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).getUTCDay(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js new file mode 100644 index 0000000000..942e781079 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/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.getutcday +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 getUTCDay = Date.prototype.getUTCDay; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCDay, 'function'); + +assert.throws(TypeError, function() { + getUTCDay.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCDay.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCDay.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js new file mode 100644 index 0000000000..64f3a903e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/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.getutcdaty +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 getUTCDay = Date.prototype.getUTCDay; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCDay, 'function'); + +assert.throws(TypeError, function() { + getUTCDay.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCDay.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCDay.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCDay.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCDay.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCDay.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js new file mode 100644 index 0000000000..8576c6bee9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js @@ -0,0 +1,44 @@ +// 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.getutcday +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return WeekDay(t). +---*/ + +var july6 = 1467763200000; +var july9 = 1468022400000; +var dayMs = 24 * 60 * 60 * 1000; + +assert.sameValue(new Date(july6).getUTCDay(), 3, 'first millisecond'); +assert.sameValue( + new Date(july6 - 1).getUTCDay(), 2, 'previous millisecond' +); +assert.sameValue( + new Date(july6 + dayMs - 1).getUTCDay(), 3, 'final millisecond' +); +assert.sameValue( + new Date(july6 + dayMs).getUTCDay(), 4, 'subsequent millisecond' +); + +assert.sameValue( + new Date(july9).getUTCDay(), 6, 'first millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 - 1).getUTCDay(), 5, 'previous millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 + dayMs - 1).getUTCDay(), + 6, + 'final millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 + dayMs).getUTCDay(), + 0, + 'subsequent millisecond (week boundary)' +); + +reportCompare(0, 0); -- cgit v1.2.3