Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Date/S15.9.3.1_A3_T3.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 es5id: 15.9.3.1_A3_T3.2
10 description: >
11 Test based on overwriting prototype.toString - 4 arguments, (year,
12 month, date, hours)
13 ---*/
14
15 Date.prototype.toString = Object.prototype.toString;
16
17 var x1 = new Date(1899, 11, 31, 23);
18 if (x1.toString() !== "[object Date]") {
19 $ERROR("#1: The [[Class]] property of the newly constructed object is set to 'Date'");
20 }
21
22 var x2 = new Date(1899, 12, 1, 0);
23 if (x2.toString() !== "[object Date]") {
24 $ERROR("#2: The [[Class]] property of the newly constructed object is set to 'Date'");
25 }
26
27 var x3 = new Date(1900, 0, 1, 0);
28 if (x3.toString() !== "[object Date]") {
29 $ERROR("#3: The [[Class]] property of the newly constructed object is set to 'Date'");
30 }
31
32 var x4 = new Date(1969, 11, 31, 23);
33 if (x4.toString() !== "[object Date]") {
34 $ERROR("#4: The [[Class]] property of the newly constructed object is set to 'Date'");
35 }
36
37 var x5 = new Date(1969, 12, 1, 0);
38 if (x5.toString() !== "[object Date]") {
39 $ERROR("#5: The [[Class]] property of the newly constructed object is set to 'Date'");
40 }
41
42 var x6 = new Date(1970, 0, 1, 0);
43 if (x6.toString() !== "[object Date]") {
44 $ERROR("#6: The [[Class]] property of the newly constructed object is set to 'Date'");
45 }
46
47 var x7 = new Date(1999, 11, 31, 23);
48 if (x7.toString() !== "[object Date]") {
49 $ERROR("#7: The [[Class]] property of the newly constructed object is set to 'Date'");
50 }
51
52 var x8 = new Date(1999, 12, 1, 0);
53 if (x8.toString() !== "[object Date]") {
54 $ERROR("#8: The [[Class]] property of the newly constructed object is set to 'Date'");
55 }
56
57 var x9 = new Date(2000, 0, 1, 0);
58 if (x9.toString() !== "[object Date]") {
59 $ERROR("#9: The [[Class]] property of the newly constructed object is set to 'Date'");
60 }
61
62 var x10 = new Date(2099, 11, 31, 23);
63 if (x10.toString() !== "[object Date]") {
64 $ERROR("#10: The [[Class]] property of the newly constructed object is set to 'Date'");
65 }
66
67 var x11 = new Date(2099, 12, 1, 0);
68 if (x11.toString() !== "[object Date]") {
69 $ERROR("#11: The [[Class]] property of the newly constructed object is set to 'Date'");
70 }
71
72 var x12 = new Date(2100, 0, 1, 0);
73 if (x12.toString() !== "[object Date]") {
74 $ERROR("#12: The [[Class]] property of the newly constructed object is set to 'Date'");
75 }