From 018ad2110d8d083c9806a481029a04a0e7548ddf Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 10 May 2016 16:59:19 -0400 Subject: [PATCH 1/3] Streamline tests for Date.prototype.toGMTString Introduce a test that asserts the equality of `Date.prototype.toGMTString` and `Date.prototype.toUTCString`, rendering further tests for the former's behavior unnecessary. --- .../toGMTString/B.2.6.propertyCheck.js | 11 ------- .../Date/prototype/toGMTString/length.js | 29 ------------------- .../Date/prototype/toGMTString/name.js | 26 ----------------- .../toGMTString/{B.2.6.js => prop-desc.js} | 0 .../Date/prototype/toGMTString/value.js | 14 +++++++++ 5 files changed, 14 insertions(+), 66 deletions(-) delete mode 100644 test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.propertyCheck.js delete mode 100755 test/annexB/built-ins/Date/prototype/toGMTString/length.js delete mode 100755 test/annexB/built-ins/Date/prototype/toGMTString/name.js rename test/annexB/built-ins/Date/prototype/toGMTString/{B.2.6.js => prop-desc.js} (100%) create mode 100644 test/annexB/built-ins/Date/prototype/toGMTString/value.js diff --git a/test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.propertyCheck.js b/test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.propertyCheck.js deleted file mode 100644 index d09596d9e4..0000000000 --- a/test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.propertyCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Check type of various properties -es5id: B.2.6 -description: Checking properties of the Date object (toGMTString) ----*/ - -if (typeof Date.prototype.toGMTString !== "function") $ERROR('#1: typeof Date.prototype.toGMTString === "function". Actual: ' + (typeof Date.prototype.toGMTString )); -if (typeof Date.prototype['toGMTString'] !== "function") $ERROR('#2: typeof Date.prototype["toGMTString"] === "function". Actual: ' + (typeof Date.prototype["toGMTString"] )); diff --git a/test/annexB/built-ins/Date/prototype/toGMTString/length.js b/test/annexB/built-ins/Date/prototype/toGMTString/length.js deleted file mode 100755 index 216dd9e718..0000000000 --- a/test/annexB/built-ins/Date/prototype/toGMTString/length.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es6id: B.2.4.3 -description: > - Date.prototype.toGMTString.length is 0. -info: > - Date.prototype.toGMTString ( ) - - 17 ECMAScript Standard Built-in Objects: - Every built-in Function object, including constructors, has a length - property whose value is an integer. Unless otherwise specified, this - value is equal to the largest number of named arguments shown in the - subclause headings for the function description, including optional - parameters. However, rest parameters shown using the form “...name” - are not included in the default argument count. - - Unless otherwise specified, the length property of a built-in Function - object has the attributes { [[Writable]]: false, [[Enumerable]]: false, - [[Configurable]]: true }. -includes: [propertyHelper.js] ----*/ - -assert.sameValue(Date.prototype.toGMTString.length, 0); - -verifyNotEnumerable(Date.prototype.toGMTString, "length"); -verifyNotWritable(Date.prototype.toGMTString, "length"); -verifyConfigurable(Date.prototype.toGMTString, "length"); diff --git a/test/annexB/built-ins/Date/prototype/toGMTString/name.js b/test/annexB/built-ins/Date/prototype/toGMTString/name.js deleted file mode 100755 index 56f10aa86c..0000000000 --- a/test/annexB/built-ins/Date/prototype/toGMTString/name.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es6id: B.2.4.3 -description: > - Date.prototype.toGMTString.name is "toUTCString". -info: > - Date.prototype.toGMTString ( ) - - 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.toGMTString.name, "toUTCString"); - -verifyNotEnumerable(Date.prototype.toGMTString, "name"); -verifyNotWritable(Date.prototype.toGMTString, "name"); -verifyConfigurable(Date.prototype.toGMTString, "name"); diff --git a/test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.js b/test/annexB/built-ins/Date/prototype/toGMTString/prop-desc.js similarity index 100% rename from test/annexB/built-ins/Date/prototype/toGMTString/B.2.6.js rename to test/annexB/built-ins/Date/prototype/toGMTString/prop-desc.js diff --git a/test/annexB/built-ins/Date/prototype/toGMTString/value.js b/test/annexB/built-ins/Date/prototype/toGMTString/value.js new file mode 100644 index 0000000000..516812feab --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/toGMTString/value.js @@ -0,0 +1,14 @@ +// 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.togmtstring +es6id: B.2.4.3 +es5id: B.2.6 +description: Value of `Date.prototype.toGMTString` +info: > + The function object that is the initial value of Date.prototype.toGMTString + is the same function object that is the initial value of + Date.prototype.toUTCString. +---*/ + +assert.sameValue(Date.prototype.toGMTString, Date.prototype.toUTCString); From 1a66e812c8b6039d12ba2409e0aec6f5c42ad5a5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 10 May 2016 17:00:12 -0400 Subject: [PATCH 2/3] Add tests for Date.prototype.setYear --- .../prototype/setYear/B.2.5.propertyCheck.js | 11 ----- .../Date/prototype/setYear/this-not-date.js | 26 +++++++++++ .../Date/prototype/setYear/this-time-nan.js | 18 ++++++++ .../Date/prototype/setYear/this-time-valid.js | 19 ++++++++ .../Date/prototype/setYear/time-clip.js | 34 ++++++++++++++ .../Date/prototype/setYear/year-nan.js | 36 +++++++++++++++ .../prototype/setYear/year-number-absolute.js | 42 +++++++++++++++++ .../prototype/setYear/year-number-relative.js | 45 +++++++++++++++++++ .../prototype/setYear/year-to-number-err.js | 29 ++++++++++++ 9 files changed, 249 insertions(+), 11 deletions(-) delete mode 100644 test/annexB/built-ins/Date/prototype/setYear/B.2.5.propertyCheck.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/this-not-date.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/this-time-nan.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/this-time-valid.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/time-clip.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/year-nan.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/year-number-absolute.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/year-number-relative.js create mode 100644 test/annexB/built-ins/Date/prototype/setYear/year-to-number-err.js diff --git a/test/annexB/built-ins/Date/prototype/setYear/B.2.5.propertyCheck.js b/test/annexB/built-ins/Date/prototype/setYear/B.2.5.propertyCheck.js deleted file mode 100644 index 40a4ae3376..0000000000 --- a/test/annexB/built-ins/Date/prototype/setYear/B.2.5.propertyCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Check type of various properties -es5id: B.2.5 -description: Checking properties of the Date object (setYear) ----*/ - -if (typeof Date.prototype.setYear !== "function") $ERROR('#1: typeof Date.prototype.setYear === "function". Actual: ' + (typeof Date.prototype.setYear )); -if (typeof Date.prototype['setYear'] !== "function") $ERROR('#2: typeof Date.prototype["setYear"] === "function". Actual: ' + (typeof Date.prototype["setYear"] )); diff --git a/test/annexB/built-ins/Date/prototype/setYear/this-not-date.js b/test/annexB/built-ins/Date/prototype/setYear/this-not-date.js new file mode 100644 index 0000000000..ed6917cd63 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/this-not-date.js @@ -0,0 +1,26 @@ +// 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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: Behavior when "this" value has no [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). +---*/ + +var setYear = Date.prototype.setYear; + +assert.sameValue(typeof setYear, 'function'); + +assert.throws(TypeError, function() { + setYear.call({}, 1); +}, 'object'); + +assert.throws(TypeError, function() { + setYear.call(undefined, 1); +}, 'undefined'); + +assert.throws(TypeError, function() { + setYear.call(null, 1); +}, 'null'); diff --git a/test/annexB/built-ins/Date/prototype/setYear/this-time-nan.js b/test/annexB/built-ins/Date/prototype/setYear/this-time-nan.js new file mode 100644 index 0000000000..2f1959d5e7 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/this-time-nan.js @@ -0,0 +1,18 @@ +// 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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: > + Behavior when the [[DateValue]] internal slot of "this" value is NaN +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). +---*/ + +var date = new Date({}); +var expected = new Date(1971, 0).valueOf(); + +assert.sameValue(date.setYear(71), expected, 'method return value'); +assert.sameValue(date.valueOf(), expected, '[[DateValue]] internal slot'); diff --git a/test/annexB/built-ins/Date/prototype/setYear/this-time-valid.js b/test/annexB/built-ins/Date/prototype/setYear/this-time-valid.js new file mode 100644 index 0000000000..a132661161 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/this-time-valid.js @@ -0,0 +1,19 @@ +// 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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: > + Behavior when the [[DateValue]] internal slot of "this" value is an integer + value +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). +---*/ + +var date = new Date(1970, 1, 2, 3, 4, 5); +var expected = new Date(1971, 1, 2, 3, 4, 5).valueOf(); + +assert.sameValue(date.setYear(71), expected, 'method return value'); +assert.sameValue(date.valueOf(), expected, '[[DateValue]] internal slot'); diff --git a/test/annexB/built-ins/Date/prototype/setYear/time-clip.js b/test/annexB/built-ins/Date/prototype/setYear/time-clip.js new file mode 100644 index 0000000000..27352d0e34 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/time-clip.js @@ -0,0 +1,34 @@ +// 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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: Clipping of new time value +info: | + [...] + 9. Set the [[DateValue]] internal slot of this Date object to + TimeClip(date). + 10. Return the value of the [[DateValue]] internal slot of this Date + object. +---*/ + +var date; + +date = new Date(1970, 8, 12, 20, 0, 0, 0); + +assert.notSameValue( + date.setYear(275760), NaN, 'method return value (valid date)' +); +assert.notSameValue( + date.valueOf(), NaN, '[[DateValue]] internal slot (valid date)' +); + +date = new Date(1970, 8, 12, 20, 0, 0, 1); + +assert.sameValue( + date.setYear(275760), NaN, 'method return value (invalid date)' +); +assert.sameValue( + date.valueOf(), NaN, '[[DateValue]] internal slot (invalid date)' +); diff --git a/test/annexB/built-ins/Date/prototype/setYear/year-nan.js b/test/annexB/built-ins/Date/prototype/setYear/year-nan.js new file mode 100644 index 0000000000..23cf552504 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/year-nan.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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: Behavior when year value coerces to NaN +info: | + [...] + 3. Let y be ? ToNumber(year). + 4. If y is NaN, set the [[DateValue]] internal slot of this Date object to + NaN and return NaN. +features: [Symbol] +---*/ + +var date; + +date = new Date(); +assert.sameValue(date.setYear(), NaN, 'return value (no argument)'); +assert.sameValue( + date.valueOf(), NaN, '[[DateValue]] internal slot (no argument)' +); + +date = new Date(); +assert.sameValue(date.setYear(NaN), NaN, 'return value (literal NaN)'); +assert.sameValue( + date.valueOf(), NaN, '[[DateValue]] internal slot (literal NaN)' +); + +date = new Date(); +assert.sameValue( + date.setYear('not a number'), NaN, 'return value (NaN from ToNumber)' +); +assert.sameValue( + date.valueOf(), NaN, '[[DateValue]] internal slot (NaN from ToNumber)' +); diff --git a/test/annexB/built-ins/Date/prototype/setYear/year-number-absolute.js b/test/annexB/built-ins/Date/prototype/setYear/year-number-absolute.js new file mode 100644 index 0000000000..f4a9549768 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/year-number-absolute.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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: > + Behavior when the integer representation of the specified `year` is not + relative to 1900 +info: | + [...] + 5. If y is not NaN and 0 ≤ ToInteger(y) ≤ 99, let yyyy be ToInteger(y) + + 1900. + 6. Else, let yyyy be y. + [...] +---*/ + +var date; + +date = new Date(1970, 0); +date.setYear(-1); +assert.sameValue(date.getFullYear(), -1); + +date = new Date(1970, 0); +date.setYear(100); +assert.sameValue(date.getFullYear(), 100); + +date = new Date(1970, 0); +date.setYear(1899); +assert.sameValue(date.getFullYear(), 1899); + +date = new Date(1970, 0); +date.setYear(1900); +assert.sameValue(date.getFullYear(), 1900); + +date = new Date(1970, 0); +date.setYear(1999); +assert.sameValue(date.getFullYear(), 1999); + +date = new Date(1970, 0); +date.setYear(2000); +assert.sameValue(date.getFullYear(), 2000); diff --git a/test/annexB/built-ins/Date/prototype/setYear/year-number-relative.js b/test/annexB/built-ins/Date/prototype/setYear/year-number-relative.js new file mode 100644 index 0000000000..45fba55b59 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/year-number-relative.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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: > + Behavior when the integer representation of the specified `year` is + relative to 1900 +info: | + [...] + 5. If y is not NaN and 0 ≤ ToInteger(y) ≤ 99, let yyyy be ToInteger(y) + + 1900. + [...] +---*/ + +var date; + +date = new Date(1970, 0); +date.setYear(-0.9999999); +assert.sameValue(date.getFullYear(), 1900, 'y = -0.999999'); + +date = new Date(1970, 0); +date.setYear(-0); +assert.sameValue(date.getFullYear(), 1900, 'y = -0'); + +date = new Date(1970, 0); +date.setYear(0); +assert.sameValue(date.getFullYear(), 1900, 'y = 0'); + +date = new Date(1970, 0); +date.setYear(50); +assert.sameValue(date.getFullYear(), 1950, 'y = 50'); + +date = new Date(1970, 0); +date.setYear(50.999999); +assert.sameValue(date.getFullYear(), 1950, 'y = 50.999999'); + +date = new Date(1970, 0); +date.setYear(99); +assert.sameValue(date.getFullYear(), 1999, 'y = 99'); + +date = new Date(1970, 0); +date.setYear(99.999999); +assert.sameValue(date.getFullYear(), 1999, 'y = 99.999999'); diff --git a/test/annexB/built-ins/Date/prototype/setYear/year-to-number-err.js b/test/annexB/built-ins/Date/prototype/setYear/year-to-number-err.js new file mode 100644 index 0000000000..6c834d7c37 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/setYear/year-to-number-err.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.setyear +es6id: B.2.4.2 +es5id: B.2.5 +description: > + Behavior when calling ToNumber on year value returns an abrupt completion +info: | + [...] + 3. Let y be ? ToNumber(year). +features: [Symbol] +---*/ + +var date = new Date(); +var symbol = Symbol(''); +var year = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setYear(year); +}); + +assert.throws(TypeError, function() { + date.setYear(symbol); +}); From 37b3e7c080b51383d34a97b26e85934bc144543c Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 10 May 2016 17:00:28 -0400 Subject: [PATCH 3/3] Add tests for Date.prototype.getYear --- .../prototype/getYear/B.2.4.propertyCheck.js | 11 ----- .../built-ins/Date/prototype/getYear/nan.js | 15 +++++++ .../Date/prototype/getYear/return-value.js | 41 +++++++++++++++++++ .../Date/prototype/getYear/this-not-date.js | 26 ++++++++++++ 4 files changed, 82 insertions(+), 11 deletions(-) delete mode 100644 test/annexB/built-ins/Date/prototype/getYear/B.2.4.propertyCheck.js create mode 100644 test/annexB/built-ins/Date/prototype/getYear/nan.js create mode 100644 test/annexB/built-ins/Date/prototype/getYear/return-value.js create mode 100644 test/annexB/built-ins/Date/prototype/getYear/this-not-date.js diff --git a/test/annexB/built-ins/Date/prototype/getYear/B.2.4.propertyCheck.js b/test/annexB/built-ins/Date/prototype/getYear/B.2.4.propertyCheck.js deleted file mode 100644 index 38223ba3d0..0000000000 --- a/test/annexB/built-ins/Date/prototype/getYear/B.2.4.propertyCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Check type of various properties -es5id: B.2.4 -description: Checking properties of the Date object (getYear) ----*/ - -if (typeof Date.prototype.getYear !== "function") $ERROR('#1: typeof Date.prototype.getYear === "function". Actual: ' + (typeof Date.prototype.getYear )); -if (typeof Date.prototype['getYear'] !== "function") $ERROR('#2: typeof Date.prototype["getYear"] === "function". Actual: ' + (typeof Date.prototype["getYear"] )); diff --git a/test/annexB/built-ins/Date/prototype/getYear/nan.js b/test/annexB/built-ins/Date/prototype/getYear/nan.js new file mode 100644 index 0000000000..1d4db853b3 --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/getYear/nan.js @@ -0,0 +1,15 @@ +// 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.getyear +es6id: B.2.4.1 +es5id: B.2.4 +description: NaN time value +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +var date = new Date({}); + +assert.sameValue(date.getYear(), NaN); diff --git a/test/annexB/built-ins/Date/prototype/getYear/return-value.js b/test/annexB/built-ins/Date/prototype/getYear/return-value.js new file mode 100644 index 0000000000..f379bab10c --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/getYear/return-value.js @@ -0,0 +1,41 @@ +// 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.getyear +es6id: B.2.4.1 +es5id: B.2.4 +description: > + Return value for objects with numeric value in [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return YearFromTime(LocalTime(t)) - 1900. +---*/ + +assert.sameValue(new Date(1899, 0).getYear(), -1, '1899: first millisecond'); +assert.sameValue( + new Date(1899, 11, 31, 23, 59, 59, 999).getYear(), + -1, + '1899: final millisecond' +); + +assert.sameValue(new Date(1900, 0).getYear(), 0, '1900: first millisecond'); +assert.sameValue( + new Date(1900, 11, 31, 23, 59, 59, 999).getYear(), + 0, + '1900: final millisecond' +); + +assert.sameValue(new Date(1970, 0).getYear(), 70, '1970: first millisecond'); +assert.sameValue( + new Date(1970, 11, 31, 23, 59, 59, 999).getYear(), + 70, + '1970: final millisecond' +); + +assert.sameValue(new Date(2000, 0).getYear(), 100, '2000: first millisecond'); +assert.sameValue( + new Date(2000, 11, 31, 23, 59, 59, 999).getYear(), + 100, + '2000: final millisecond' +); diff --git a/test/annexB/built-ins/Date/prototype/getYear/this-not-date.js b/test/annexB/built-ins/Date/prototype/getYear/this-not-date.js new file mode 100644 index 0000000000..86f9a652dd --- /dev/null +++ b/test/annexB/built-ins/Date/prototype/getYear/this-not-date.js @@ -0,0 +1,26 @@ +// 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.getyear +es6id: B.2.4.1 +es5id: B.2.4 +description: Behavior when `this` value has no [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). +---*/ + +var getYear = Date.prototype.getYear; + +assert.sameValue(typeof getYear, 'function'); + +assert.throws(TypeError, function() { + getYear.call({}); +}, 'object'); + +assert.throws(TypeError, function() { + getYear.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getYear.call(null); +}, 'null');