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/getDay/S15.9.5.16_A1_T1.js | 26 ++++++++++++ .../Date/prototype/getDay/S15.9.5.16_A1_T2.js | 19 +++++++++ .../Date/prototype/getDay/S15.9.5.16_A1_T3.js | 21 ++++++++++ .../Date/prototype/getDay/S15.9.5.16_A2_T1.js | 18 +++++++++ .../Date/prototype/getDay/S15.9.5.16_A3_T1.js | 25 ++++++++++++ .../Date/prototype/getDay/S15.9.5.16_A3_T2.js | 25 ++++++++++++ .../Date/prototype/getDay/S15.9.5.16_A3_T3.js | 23 +++++++++++ .../built-ins/Date/prototype/getDay/browser.js | 0 .../built-ins/Date/prototype/getDay/name.js | 28 +++++++++++++ .../Date/prototype/getDay/not-a-constructor.js | 35 ++++++++++++++++ .../built-ins/Date/prototype/getDay/shell.js | 0 .../prototype/getDay/this-value-invalid-date.js | 13 ++++++ .../Date/prototype/getDay/this-value-non-date.js | 36 +++++++++++++++++ .../Date/prototype/getDay/this-value-non-object.js | 46 ++++++++++++++++++++++ .../Date/prototype/getDay/this-value-valid-date.js | 42 ++++++++++++++++++++ 15 files changed, 357 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/getDay') diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js new file mode 100644 index 0000000000..7fc24d1c49 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getDay; +if (x === 1) { + Date.prototype.getDay = 2; +} else { + Date.prototype.getDay = 1; +} + +assert.notSameValue( + Date.prototype.getDay, + x, + 'The value of Date.prototype.getDay 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/getDay/S15.9.5.16_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js new file mode 100644 index 0000000000..d7e7f2b9c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getDay, false, 'The value of delete Date.prototype.getDay is not false'); + +assert( + !Date.prototype.hasOwnProperty('getDay'), + 'The value of !Date.prototype.hasOwnProperty(\'getDay\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js new file mode 100644 index 0000000000..45b3e2956b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.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. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getDay'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getDay\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getDay", 'The value of x is not "getDay"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js new file mode 100644 index 0000000000..420c63de1d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.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. + +/*--- +esid: sec-date.prototype.getday +info: The "length" property of the "getDay" is 0 +es5id: 15.9.5.16_A2_T1 +description: The "length" property of the "getDay" is 0 +---*/ +assert.sameValue( + Date.prototype.getDay.hasOwnProperty("length"), + true, + 'Date.prototype.getDay.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getDay.length, 0, 'The value of Date.prototype.getDay.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js new file mode 100644 index 0000000000..05e4b08b05 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_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. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getDay.length; +verifyNotWritable(Date.prototype.getDay, "length", null, 1); + +assert.sameValue( + Date.prototype.getDay.length, + x, + 'The value of Date.prototype.getDay.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/getDay/S15.9.5.16_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js new file mode 100644 index 0000000000..e133e5c31e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_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. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, ! DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getDay.length, + true, + 'The value of `delete Date.prototype.getDay.length` is expected to be true' +); + +assert( + !Date.prototype.getDay.hasOwnProperty('length'), + 'The value of !Date.prototype.getDay.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/getDay/S15.9.5.16_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js new file mode 100644 index 0000000000..56b83dbf97 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.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. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getDay.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getDay.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getDay) { + 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/getDay/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/name.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/name.js new file mode 100644 index 0000000000..89c16d7928 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/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.getday +description: > + Date.prototype.getDay.name is "getDay". +info: | + Date.prototype.getDay ( ) + + 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.getDay.name, "getDay"); + +verifyNotEnumerable(Date.prototype.getDay, "name"); +verifyNotWritable(Date.prototype.getDay, "name"); +verifyConfigurable(Date.prototype.getDay, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js new file mode 100644 index 0000000000..08a25137e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/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.getDay 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.getDay), + false, + 'isConstructor(Date.prototype.getDay) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getDay(); +}, '`let date = new Date(Date.now()); new date.getDay()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js new file mode 100644 index 0000000000..2040a95868 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/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.getday +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).getDay(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js new file mode 100644 index 0000000000..a800f5cc0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/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.getday +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 getDay = Date.prototype.getDay; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getDay, 'function'); + +assert.throws(TypeError, function() { + getDay.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getDay.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getDay.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js new file mode 100644 index 0000000000..708533f16f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/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.getday +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 getDay = Date.prototype.getDay; +var symbol = Symbol(); + +assert.sameValue(typeof getDay, 'function'); + +assert.throws(TypeError, function() { + getDay.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getDay.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getDay.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getDay.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getDay.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getDay.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js new file mode 100644 index 0000000000..9a792771d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js @@ -0,0 +1,42 @@ +// 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.getday +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6, 6).getDay(), 3, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 6, 0, 0, 0, -1).getDay(), 2, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 999).getDay(), 3, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 1000).getDay(), 4, 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 6, 9).getDay(), 6, 'first millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 0, 0, 0, -1).getDay(), + 5, + 'previous millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 23, 59, 59, 999).getDay(), + 6, + 'final millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 23, 59, 59, 1000).getDay(), + 0, + 'subsequent millisecond (week boundary)' +); + +reportCompare(0, 0); -- cgit v1.2.3