summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Date/prototype/setFullYear
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Date/prototype/setFullYear')
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js16
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js21
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js24
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js22
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js30
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js79
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js79
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js33
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js79
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js50
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js52
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js45
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js55
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js57
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js57
-rw-r--r--js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js29
25 files changed, 917 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js
new file mode 100644
index 0000000000..793edd6fd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-date.prototype.setfullyear
+description: >
+ Date.prototype.setFullYear - Date.prototype is itself not an
+ instance of Date
+---*/
+
+
+assert.throws(TypeError, function() {
+ Date.prototype.setFullYear(2012);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js
new file mode 100644
index 0000000000..b958ff7ac0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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 "setFullYear" has { DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking absence of ReadOnly attribute
+---*/
+
+var x = Date.prototype.setFullYear;
+if (x === 1) {
+ Date.prototype.setFullYear = 2;
+} else {
+ Date.prototype.setFullYear = 1;
+}
+
+assert.notSameValue(
+ Date.prototype.setFullYear,
+ x,
+ 'The value of Date.prototype.setFullYear 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/setFullYear/S15.9.5.40_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js
new file mode 100644
index 0000000000..ac18a41d6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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 "setFullYear" has { DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking absence of DontDelete attribute
+---*/
+assert.notSameValue(
+ delete Date.prototype.setFullYear,
+ false,
+ 'The value of delete Date.prototype.setFullYear is not false'
+);
+
+assert(
+ !Date.prototype.hasOwnProperty('setFullYear'),
+ 'The value of !Date.prototype.hasOwnProperty(\'setFullYear\') is expected to be true'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js
new file mode 100644
index 0000000000..f342b57550
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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 "setFullYear" has { DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.propertyIsEnumerable('setFullYear'),
+ 'The value of !Date.prototype.propertyIsEnumerable(\'setFullYear\') is expected to be true'
+);
+
+for (var x in Date.prototype) {
+ assert.notSameValue(x, "setFullYear", 'The value of x is not "setFullYear"');
+}
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js
new file mode 100644
index 0000000000..f7f92225f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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 "setFullYear" is 3
+esid: sec-date.prototype.setfullyear
+description: The "length" property of the "setFullYear" is 3
+---*/
+assert.sameValue(
+ Date.prototype.setFullYear.hasOwnProperty("length"),
+ true,
+ 'Date.prototype.setFullYear.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(
+ Date.prototype.setFullYear.length,
+ 3,
+ 'The value of Date.prototype.setFullYear.length is expected to be 3'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js
new file mode 100644
index 0000000000..9f8c4bf99c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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.setFullYear property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking ReadOnly attribute
+includes: [propertyHelper.js]
+---*/
+
+var x = Date.prototype.setFullYear.length;
+verifyNotWritable(Date.prototype.setFullYear, "length", null, 1);
+
+assert.sameValue(
+ Date.prototype.setFullYear.length,
+ x,
+ 'The value of Date.prototype.setFullYear.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/setFullYear/S15.9.5.40_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js
new file mode 100644
index 0000000000..562b430dcf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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.setFullYear property "length" has { ReadOnly, !
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking DontDelete attribute
+---*/
+assert.sameValue(
+ delete Date.prototype.setFullYear.length,
+ true,
+ 'The value of `delete Date.prototype.setFullYear.length` is expected to be true'
+);
+
+assert(
+ !Date.prototype.setFullYear.hasOwnProperty('length'),
+ 'The value of !Date.prototype.setFullYear.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/setFullYear/S15.9.5.40_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js
new file mode 100644
index 0000000000..707623ba51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_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.setFullYear property "length" has { ReadOnly,
+ DontDelete, DontEnum } attributes
+esid: sec-date.prototype.setfullyear
+description: Checking DontEnum attribute
+---*/
+assert(
+ !Date.prototype.setFullYear.propertyIsEnumerable('length'),
+ 'The value of !Date.prototype.setFullYear.propertyIsEnumerable(\'length\') is expected to be true'
+);
+
+for (var x in Date.prototype.setFullYear) {
+ 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/setFullYear/arg-date-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js
new file mode 100644
index 0000000000..33e6e9b366
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js
@@ -0,0 +1,30 @@
+// 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.setfullyear
+description: Abrupt completion during type coercion of provided "date"
+info: |
+ 1. Let t be LocalTime(? thisTimeValue(this value)).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+---*/
+
+var date = new Date();
+var originalValue = date.getTime();
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ date.setFullYear(0, 0, obj);
+});
+
+assert.sameValue(date.getTime(), originalValue);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js
new file mode 100644
index 0000000000..00773ce72b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js
@@ -0,0 +1,79 @@
+// 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.setfullyear
+description: Type coercion of provided "date"
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6, 7, 11, 36, 23, 2);
+var callCount = 0;
+var arg = {
+ valueOf: function() {
+ args = arguments;
+ thisValue = this;
+ callCount += 1;
+ return 2;
+ }
+};
+var args, thisValue, returnValue;
+
+returnValue = date.setFullYear(2016, 6, arg);
+
+assert.sameValue(callCount, 1, 'invoked exactly once');
+assert.sameValue(args.length, 0, 'invoked without arguments');
+assert.sameValue(thisValue, arg, '"this" value');
+assert.sameValue(
+ returnValue,
+ new Date(2016, 6, 2, 11, 36, 23, 2).getTime(),
+ 'application of specified value'
+);
+
+returnValue = date.setFullYear(2016, 6, null);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 6, 0, 11, 36, 23, 2).getTime(),
+ 'null'
+);
+
+returnValue = date.setFullYear(2016, 6, true);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 6, 1, 11, 36, 23, 2).getTime(),
+ 'true'
+);
+
+returnValue = date.setFullYear(2016, 6, false);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 6, 0, 11, 36, 23, 2).getTime(),
+ 'false'
+);
+
+returnValue = date.setFullYear(2016, 6, ' +00200.000E-0002 ');
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 6, 2, 11, 36, 23, 2).getTime(),
+ 'string'
+);
+
+returnValue = date.setFullYear(2016, 6, undefined);
+
+assert.sameValue(returnValue, NaN, 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js
new file mode 100644
index 0000000000..46bb7e8597
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js
@@ -0,0 +1,35 @@
+// 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.setfullyear
+description: Abrupt completion during type coercion of provided "month"
+info: |
+ 1. Let t be LocalTime(? thisTimeValue(this value)).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+---*/
+
+var date = new Date();
+var callCount = 0;
+var originalValue = date.getTime();
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+var counter = {
+ valueOf: function() {
+ callCount += 1;
+ }
+};
+
+assert.throws(Test262Error, function() {
+ date.setFullYear(0, obj, counter);
+});
+
+assert.sameValue(date.getTime(), originalValue);
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js
new file mode 100644
index 0000000000..500ad370fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js
@@ -0,0 +1,79 @@
+// 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.setfullyear
+description: Type coercion of provided "month"
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6, 7, 11, 36, 23, 2);
+var callCount = 0;
+var arg = {
+ valueOf: function() {
+ args = arguments;
+ thisValue = this;
+ callCount += 1;
+ return 2;
+ }
+};
+var args, thisValue, returnValue;
+
+returnValue = date.setFullYear(2016, arg);
+
+assert.sameValue(callCount, 1, 'invoked exactly once');
+assert.sameValue(args.length, 0, 'invoked without arguments');
+assert.sameValue(thisValue, arg, '"this" value');
+assert.sameValue(
+ returnValue,
+ new Date(2016, 2, 7, 11, 36, 23, 2).getTime(),
+ 'application of specified value'
+);
+
+returnValue = date.setFullYear(2016, null);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 0, 7, 11, 36, 23, 2).getTime(),
+ 'null'
+);
+
+returnValue = date.setFullYear(2016, true);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 1, 7, 11, 36, 23, 2).getTime(),
+ 'true'
+);
+
+returnValue = date.setFullYear(2016, false);
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 0, 7, 11, 36, 23, 2).getTime(),
+ 'false'
+);
+
+returnValue = date.setFullYear(2016, ' +00200.000E-0002 ');
+
+assert.sameValue(
+ returnValue,
+ new Date(2016, 2, 7, 11, 36, 23, 2).getTime(),
+ 'string'
+);
+
+returnValue = date.setFullYear(2016, undefined);
+
+assert.sameValue(returnValue, NaN, 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js
new file mode 100644
index 0000000000..a8ec29c120
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js
@@ -0,0 +1,33 @@
+// 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.setfullyear
+description: Abrupt completion during type coercion of provided "year"
+info: |
+ 1. Let t be LocalTime(? thisTimeValue(this value)).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+---*/
+
+var date = new Date();
+var callCount = 0;
+var originalValue = date.getTime();
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+var counter = {
+ valueOf: function() {
+ callCount += 1;
+ }
+};
+
+assert.throws(Test262Error, function() {
+ date.setFullYear(obj, counter, counter);
+});
+
+assert.sameValue(date.getTime(), originalValue);
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js
new file mode 100644
index 0000000000..aa8481972f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js
@@ -0,0 +1,79 @@
+// 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.setfullyear
+description: Type coercion of provided "year"
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6, 7, 11, 36, 23, 2);
+var callCount = 0;
+var arg = {
+ valueOf: function() {
+ args = arguments;
+ thisValue = this;
+ callCount += 1;
+ return 2;
+ }
+};
+var args, thisValue, returnValue;
+
+returnValue = date.setFullYear(arg);
+
+assert.sameValue(callCount, 1, 'invoked exactly once');
+assert.sameValue(args.length, 0, 'invoked without arguments');
+assert.sameValue(thisValue, arg, '"this" value');
+assert.sameValue(
+ returnValue,
+ new Date(-1, 42, 7, 11, 36, 23, 2).getTime(),
+ 'application of specified value'
+);
+
+returnValue = date.setFullYear(null);
+
+assert.sameValue(
+ returnValue,
+ new Date(-1, 18, 7, 11, 36, 23, 2).getTime(),
+ 'null'
+);
+
+returnValue = date.setFullYear(true);
+
+assert.sameValue(
+ returnValue,
+ new Date(-1, 30, 7, 11, 36, 23, 2).getTime(),
+ 'true'
+);
+
+returnValue = date.setFullYear(false);
+
+assert.sameValue(
+ returnValue,
+ new Date(-1, 18, 7, 11, 36, 23, 2).getTime(),
+ 'false'
+);
+
+returnValue = date.setFullYear(' +00200.000E-0002 ');
+
+assert.sameValue(
+ returnValue,
+ new Date(-1, 42, 7, 11, 36, 23, 2).getTime(),
+ 'string'
+);
+
+returnValue = date.setFullYear();
+
+assert.sameValue(returnValue, NaN, 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js
new file mode 100644
index 0000000000..07255899ed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/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.setfullyear
+description: >
+ Date.prototype.setFullYear.name is "setFullYear".
+info: |
+ Date.prototype.setFullYear ( year [ , 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.setFullYear.name, "setFullYear");
+
+verifyNotEnumerable(Date.prototype.setFullYear, "name");
+verifyNotWritable(Date.prototype.setFullYear, "name");
+verifyConfigurable(Date.prototype.setFullYear, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js
new file mode 100644
index 0000000000..87db6a917d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js
@@ -0,0 +1,50 @@
+// 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.setfullyear
+description: Behavior when new value exceeds [[DateValue]] limits
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+
+ TimeClip (time)
+
+ 1. If time is not finite, return NaN.
+ 2. If abs(time) > 8.64 × 1015, return NaN.
+---*/
+
+var maxMs = 8.64e15;
+var maxYear = 275760;
+var maxDate = 12;
+var maxMonth = 8;
+var date = new Date(maxMs);
+var returnValue;
+
+assert.notSameValue(date.getTime(), NaN);
+
+returnValue = date.setFullYear(maxYear + 1);
+
+assert.sameValue(returnValue, NaN, 'overflow due to year');
+
+date = new Date(maxMs);
+
+returnValue = date.setFullYear(maxYear, maxMonth + 1);
+
+assert.sameValue(returnValue, NaN, 'overflow due to month');
+
+date = new Date(maxMs);
+
+returnValue = date.setFullYear(maxYear, maxMonth, maxDate + 2);
+
+assert.sameValue(returnValue, NaN, 'overflow due to date');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js
new file mode 100644
index 0000000000..99b1f387c3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/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.setFullYear 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.setFullYear),
+ false,
+ 'isConstructor(Date.prototype.setFullYear) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let date = new Date(Date.now()); new date.setFullYear();
+}, '`let date = new Date(Date.now()); new date.setFullYear()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js
new file mode 100644
index 0000000000..11b2839acd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js
@@ -0,0 +1,52 @@
+// 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.setfullyear
+description: >
+ Behavior when the "this" value is a Date object describing an invald date
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(NaN);
+var expected, result;
+
+result = date.setFullYear(2016);
+
+expected = new Date(2016, 0).getTime();
+assert.sameValue(result, expected, 'return value (year)');
+assert.sameValue(
+ date.getTime(), expected, '[[DateValue]] internal slot (year)'
+);
+
+date = new Date(NaN);
+
+result = date.setFullYear(2016, 6);
+
+expected = new Date(2016, 6).getTime();
+assert.sameValue(result, expected, 'return value (month)');
+assert.sameValue(
+ date.getTime(), expected, '[[DateValue]] internal slot (month)'
+);
+
+date = new Date(NaN);
+
+result = date.setFullYear(2016, 6, 7);
+
+expected = new Date(2016, 6, 7).getTime();
+assert.sameValue(result, expected, 'return value (date)');
+assert.sameValue(
+ date.getTime(), expected, '[[DateValue]] internal slot (month)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js
new file mode 100644
index 0000000000..e7d7d9eaee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-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.setfullyear
+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 setFullYear = Date.prototype.setFullYear;
+var callCount = 0;
+var arg = {
+ valueOf: function() {
+ callCount += 1;
+ return 1;
+ }
+};
+var args = (function() {
+ return arguments;
+}());
+
+assert.sameValue(typeof setFullYear, 'function');
+
+assert.throws(TypeError, function() {
+ setFullYear.call({}, arg);
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ setFullYear.call([], arg);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(args, arg);
+}, 'arguments exotic object');
+
+assert.sameValue(callCount, 0, 'validation precedes input coercion');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js
new file mode 100644
index 0000000000..d6646d55d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js
@@ -0,0 +1,55 @@
+// 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.setfullyear
+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 setFullYear = Date.prototype.setFullYear;
+var callCount = 0;
+var arg = {
+ valueOf: function() {
+ callCount += 1;
+ return 1;
+ }
+};
+var symbol = Symbol();
+
+assert.sameValue(typeof setFullYear, 'function');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(0, arg);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(true, arg);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(null, arg);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(undefined, arg);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ setFullYear.call('', arg);
+}, 'string');
+
+assert.throws(TypeError, function() {
+ setFullYear.call(symbol, arg);
+}, 'symbol');
+
+assert.sameValue(callCount, 0, 'validation precedes input coercion');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js
new file mode 100644
index 0000000000..a11967b4f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js
@@ -0,0 +1,57 @@
+// 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.setfullyear
+description: Return value for valid dates (setting date)
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6);
+var returnValue, expected;
+
+returnValue = date.setFullYear(2016, 6, 6);
+
+expected = new Date(2016, 6, 6).getTime();
+assert.sameValue(
+ returnValue, expected, 'date within unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(), expected, 'date within unit boundary ([[DateValue]] slot)'
+);
+
+returnValue = date.setFullYear(2016, 6, 0);
+
+expected = new Date(2016, 5, 30).getTime();
+assert.sameValue(
+ returnValue, expected, 'date before time unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(),
+ expected,
+ 'date before time unit boundary ([[DateValue]] slot)'
+);
+
+returnValue = date.setFullYear(2016, 5, 31);
+
+expected = new Date(2016, 6, 1).getTime();
+assert.sameValue(
+ returnValue, expected, 'date after time unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(),
+ expected,
+ 'date after time unit boundary ([[DateValue]] slot)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js
new file mode 100644
index 0000000000..29248c387a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js
@@ -0,0 +1,57 @@
+// 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.setfullyear
+description: Return value for valid dates (setting month)
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6);
+var returnValue, expected;
+
+returnValue = date.setFullYear(2016, 3);
+
+expected = new Date(2016, 3).getTime();
+assert.sameValue(
+ returnValue, expected, 'month within unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(), expected, 'month within unit boundary ([[DateValue]] slot)'
+);
+
+returnValue = date.setFullYear(2016, -1);
+
+expected = new Date(2015, 11).getTime();
+assert.sameValue(
+ returnValue, expected, 'month before time unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(),
+ expected,
+ 'month before time unit boundary ([[DateValue]] slot)'
+);
+
+returnValue = date.setFullYear(2016, 12);
+
+expected = new Date(2017, 0).getTime();
+assert.sameValue(
+ returnValue, expected, 'month after time unit boundary (return value)'
+);
+assert.sameValue(
+ date.getTime(),
+ expected,
+ 'month after time unit boundary ([[DateValue]] slot)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js
new file mode 100644
index 0000000000..bd63580906
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js
@@ -0,0 +1,29 @@
+// 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.setfullyear
+description: Return value for valid dates (setting year)
+info: |
+ 1. Let t be ? thisTimeValue(this value).
+ 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t).
+ 3. Let y be ? ToNumber(year).
+ 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be
+ ? ToNumber(month).
+ 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be
+ ? ToNumber(date).
+ 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)).
+ 7. Let u be TimeClip(UTC(newDate)).
+ 8. Set the [[DateValue]] internal slot of this Date object to u.
+ 9. Return u.
+---*/
+
+var date = new Date(2016, 6);
+var returnValue, expected;
+
+returnValue = date.setFullYear(2015);
+
+expected = new Date(2015, 6).getTime();
+assert.sameValue(returnValue, expected, 'year (return value)');
+assert.sameValue(date.getTime(), expected, 'year ([[DateValue]] slot)');
+
+reportCompare(0, 0);