Debian Codegraph @

js/src/tests/test262/built-ins/Date/S15.9.3.1_A3_T1.2.js

raw
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-year-month-date-hours-minutes-seconds-ms
9 description: >
10 Test based on overwriting prototype.toString - 2 arguments, (year,
11 month)
12 ---*/
13
14 Date.prototype.toString = Object.prototype.toString;
15
16 var x1 = new Date(1899, 11);
17 assert.sameValue(x1.toString(), "[object Date]", 'x1.toString() must return "[object Date]"');
18
19 var x2 = new Date(1899, 12);
20 assert.sameValue(x2.toString(), "[object Date]", 'x2.toString() must return "[object Date]"');
21
22 var x3 = new Date(1900, 0);
23 assert.sameValue(x3.toString(), "[object Date]", 'x3.toString() must return "[object Date]"');
24
25 var x4 = new Date(1969, 11);
26 assert.sameValue(x4.toString(), "[object Date]", 'x4.toString() must return "[object Date]"');
27
28 var x5 = new Date(1969, 12);
29 assert.sameValue(x5.toString(), "[object Date]", 'x5.toString() must return "[object Date]"');
30
31 var x6 = new Date(1970, 0);
32 assert.sameValue(x6.toString(), "[object Date]", 'x6.toString() must return "[object Date]"');
33
34 var x7 = new Date(1999, 11);
35 assert.sameValue(x7.toString(), "[object Date]", 'x7.toString() must return "[object Date]"');
36
37 var x8 = new Date(1999, 12);
38 assert.sameValue(x8.toString(), "[object Date]", 'x8.toString() must return "[object Date]"');
39
40 var x9 = new Date(2000, 0);
41 assert.sameValue(x9.toString(), "[object Date]", 'x9.toString() must return "[object Date]"');
42
43 var x10 = new Date(2099, 11);
44 assert.sameValue(x10.toString(), "[object Date]", 'x10.toString() must return "[object Date]"');
45
46 var x11 = new Date(2099, 12);
47 assert.sameValue(x11.toString(), "[object Date]", 'x11.toString() must return "[object Date]"');
48
49 var x12 = new Date(2100, 0);
50 assert.sameValue(x12.toString(), "[object Date]", 'x12.toString() must return "[object Date]"');
51
52 reportCompare(0, 0);