| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
The [[Class]] property of the newly constructed object |
| 7 |
is set to "Date" |
| 8 |
esid: sec-date-value |
| 9 |
es5id: 15.9.3.2_A3_T1.2 |
| 10 |
description: Test based on overwriting prototype.toString |
| 11 |
includes: [dateConstants.js] |
| 12 |
---*/ |
| 13 |
|
| 14 |
Date.prototype.toString = Object.prototype.toString; |
| 15 |
|
| 16 |
var x1 = new Date(date_1899_end); |
| 17 |
if (x1.toString() !== "[object Date]") { |
| 18 |
$ERROR("#1: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 19 |
} |
| 20 |
|
| 21 |
var x2 = new Date(date_1900_start); |
| 22 |
if (x2.toString() !== "[object Date]") { |
| 23 |
$ERROR("#2: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 24 |
} |
| 25 |
|
| 26 |
var x3 = new Date(date_1969_end); |
| 27 |
if (x3.toString() !== "[object Date]") { |
| 28 |
$ERROR("#3: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 29 |
} |
| 30 |
|
| 31 |
var x4 = new Date(date_1970_start); |
| 32 |
if (x4.toString() !== "[object Date]") { |
| 33 |
$ERROR("#4: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 34 |
} |
| 35 |
|
| 36 |
var x5 = new Date(date_1999_end); |
| 37 |
if (x5.toString() !== "[object Date]") { |
| 38 |
$ERROR("#5: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 39 |
} |
| 40 |
|
| 41 |
var x6 = new Date(date_2000_start); |
| 42 |
if (x6.toString() !== "[object Date]") { |
| 43 |
$ERROR("#6: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 44 |
} |
| 45 |
|
| 46 |
var x7 = new Date(date_2099_end); |
| 47 |
if (x7.toString() !== "[object Date]") { |
| 48 |
$ERROR("#7: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 49 |
} |
| 50 |
|
| 51 |
var x8 = new Date(date_2100_start); |
| 52 |
if (x8.toString() !== "[object Date]") { |
| 53 |
$ERROR("#8: The [[Class]] property of the newly constructed object is set to 'Date'"); |
| 54 |
} |