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/setUTCDate/S15.9.5.37_A1_T1.js | 25 ++++++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js | 22 ++++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js | 20 +++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js | 21 +++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js | 24 +++++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js | 24 +++++++++++++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js | 22 ++++++++++++++ .../prototype/setUTCDate/arg-coercion-order.js | 31 +++++++++++++++++++ .../built-ins/Date/prototype/setUTCDate/browser.js | 0 .../built-ins/Date/prototype/setUTCDate/name.js | 28 +++++++++++++++++ .../Date/prototype/setUTCDate/not-a-constructor.js | 35 ++++++++++++++++++++++ .../built-ins/Date/prototype/setUTCDate/shell.js | 0 12 files changed, 252 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js (limited to 'js/src/tests/test262/built-ins/Date/prototype/setUTCDate') diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js new file mode 100644 index 0000000000..0ea8716125 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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 "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCDate; +if (x === 1) { + Date.prototype.setUTCDate = 2; +} else { + Date.prototype.setUTCDate = 1; +} + +assert.notSameValue( + Date.prototype.setUTCDate, + x, + 'The value of Date.prototype.setUTCDate 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/setUTCDate/S15.9.5.37_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js new file mode 100644 index 0000000000..84187b61d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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 "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCDate, + false, + 'The value of delete Date.prototype.setUTCDate is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCDate'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCDate\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js new file mode 100644 index 0000000000..e2085634a8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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 "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCDate'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCDate\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCDate", 'The value of x is not "setUTCDate"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js new file mode 100644 index 0000000000..0d7c6f5d11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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 "setUTCDate" is 1 +esid: sec-date.prototype.setutcdate +description: The "length" property of the "setUTCDate" is 1 +---*/ +assert.sameValue( + Date.prototype.setUTCDate.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCDate.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCDate.length, + 1, + 'The value of Date.prototype.setUTCDate.length is expected to be 1' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js new file mode 100644 index 0000000000..4ec596966b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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.setUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCDate.length; +verifyNotWritable(Date.prototype.setUTCDate, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCDate.length, + x, + 'The value of Date.prototype.setUTCDate.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/setUTCDate/S15.9.5.37_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js new file mode 100644 index 0000000000..c171c07dc9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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.setUTCDate property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCDate.length, + true, + 'The value of `delete Date.prototype.setUTCDate.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCDate.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCDate.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/setUTCDate/S15.9.5.37_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js new file mode 100644 index 0000000000..9e4fd50ded --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_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.setUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCDate.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCDate.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCDate) { + 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/setUTCDate/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js new file mode 100644 index 0000000000..c00dcdd04c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcdate +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let dt be ? ToNumber(date). + 3. If t is NaN, return NaN. + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)). + 5. Let v be TimeClip(newDate). + 6. Set the [[DateValue]] internal slot of this Date object to v. + 7. Return v. +---*/ + +var date = new Date(NaN); +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 0; + } +}; + +var returnValue = date.setUTCDate(arg); + +assert.sameValue(callCount, 1, 'ToNumber invoked exactly once'); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js new file mode 100644 index 0000000000..4608a57892 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/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.setutcdate +description: > + Date.prototype.setUTCDate.name is "setUTCDate". +info: | + Date.prototype.setUTCDate ( date ) + + 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.setUTCDate.name, "setUTCDate"); + +verifyNotEnumerable(Date.prototype.setUTCDate, "name"); +verifyNotWritable(Date.prototype.setUTCDate, "name"); +verifyConfigurable(Date.prototype.setUTCDate, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js new file mode 100644 index 0000000000..eb0e04f08c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/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.setUTCDate 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.setUTCDate), + false, + 'isConstructor(Date.prototype.setUTCDate) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCDate(); +}, '`let date = new Date(Date.now()); new date.setUTCDate()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3