summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/setUTCMonth')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js42
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js0
12 files changed, 263 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js
new file mode 100644
index 0000000000..3a47d37da5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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 "setUTCMonth" has { DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.setUTCMonth;
+if (x === 1) {
+ Date.prototype.setUTCMonth = 2;
+} else {
+ Date.prototype.setUTCMonth = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.setUTCMonth,
+ x,
+ 'The value of Date.prototype.setUTCMonth 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/setUTCMonth/S15.9.5.39_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js
new file mode 100644
index 0000000000..e250febbfe
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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 "setUTCMonth" has { DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.setUTCMonth,
+ false,
+ 'The value of delete Date.prototype.setUTCMonth is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('setUTCMonth'),
+ 'The value of !Date.prototype.hasOwnProperty(\'setUTCMonth\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js
new file mode 100644
index 0000000000..bf3154fab4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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 "setUTCMonth" has { DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('setUTCMonth'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCMonth\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "setUTCMonth", 'The value of x is not "setUTCMonth"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js
new file mode 100644
index 0000000000..e917ba9810
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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 "setUTCMonth" is 2
+esid: sec-date.prototype.setutcmonth
+description: The "length" property of the "setUTCMonth" is 2
+---*/
+assert.sameValue(
+ Date.prototype.setUTCMonth.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.setUTCMonth.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.setUTCMonth.length,
+ 2,
+ 'The value of Date.prototype.setUTCMonth.length is expected to be 2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js
new file mode 100644
index 0000000000..cf63985f95
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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.setUTCMonth property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.setUTCMonth.length;
+verifyNotWritable(Date.prototype.setUTCMonth, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.setUTCMonth.length,
+ x,
+ 'The value of Date.prototype.setUTCMonth.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/setUTCMonth/S15.9.5.39_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js
new file mode 100644
index 0000000000..923cba2989
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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.setUTCMonth property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.setUTCMonth.length,
+ true,
+ 'The value of `delete Date.prototype.setUTCMonth.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.setUTCMonth.hasOwnProperty('length'),
+ 'The value of !Date.prototype.setUTCMonth.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/setUTCMonth/S15.9.5.39_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js
new file mode 100644
index 0000000000..03d107db9b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_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.setUTCMonth property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setutcmonth
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.setUTCMonth.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.setUTCMonth.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.setUTCMonth) {
+ 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/setUTCMonth/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js
new file mode 100644
index 0000000000..c94d09f56d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js
@@ -0,0 +1,42 @@
+// 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.setutcmonth
+description: Order of coercion of provided argument vs NaN check
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. Let m be ? ToNumber(month).
+ 3. If date is present, let dt be ? ToNumber(date).
+ 4. If t is NaN, return NaN.
+ 5. If date is not present, let dt be DateFromTime(t).
+ 6. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t)).
+ 7. Let v be TimeClip(newDate).
+ 8. Set the [[DateValue]] internal slot of this Date object to v.
+ 9. Return v.
+includes: [compareArray.js]
+---*/
+
+var date = new Date(NaN);
+var effects = [];
+var argMonth = {
+ valueOf: function() {
+ effects.push('valueOf month');
+ return 0;
+ }
+};
+var argDate = {
+ valueOf: function() {
+ effects.push('valueOf date');
+ return 0;
+ }
+};
+
+var returnValue = date.setUTCMonth(argMonth, argDate);
+
+var expectedEffects = ['valueOf month', 'valueOf date'];
+
+assert.compareArray(effects, expectedEffects);
+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/setUTCMonth/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js
new file mode 100644
index 0000000000..70ca8822ea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/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.setutcmonth
+description: >
+ Date.prototype.setUTCMonth.name is "setUTCMonth".
+info: |
+ Date.prototype.setUTCMonth ( month [ , 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.setUTCMonth.name, "setUTCMonth");
+
+verifyNotEnumerable(Date.prototype.setUTCMonth, "name");
+verifyNotWritable(Date.prototype.setUTCMonth, "name");
+verifyConfigurable(Date.prototype.setUTCMonth, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js
new file mode 100644
index 0000000000..977faba6d2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/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.setUTCMonth 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.setUTCMonth),
+ false,
+ 'isConstructor(Date.prototype.setUTCMonth) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.setUTCMonth();
+}, '`let date = new Date(Date.now()); new date.setUTCMonth()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js