Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / date-proto-generic-invocation.js
blob3206bf022fcc874eecd9c552c6a34b4f47004dc8
1 description("This test verifies that the functions of the Date prototype object are not generic, as documented in ECMA-262 rev3 section 15.9.5 Properties of the Date Prototype Object.");
3 var functionNames = [
4 "Date.prototype.toString",
5 "Date.prototype.toDateString",
6 "Date.prototype.toTimeString",
7 "Date.prototype.toGMTString",
8 "Date.prototype.toUTCString",
9 "Date.prototype.toLocaleString",
10 "Date.prototype.toLocaleDateString",
11 "Date.prototype.toLocaleTimeString",
12 // "Date.prototype.valueOf", --> This line seems to confuse JavaScriptCore
13 "Date.prototype.getTime",
14 "Date.prototype.getYear",
15 "Date.prototype.getFullYear",
16 "Date.prototype.getMonth",
17 "Date.prototype.getDate",
18 "Date.prototype.getDay",
19 "Date.prototype.getHours",
20 "Date.prototype.getMinutes",
21 "Date.prototype.getSeconds",
22 "Date.prototype.getMilliseconds",
23 "Date.prototype.getTimezoneOffset",
24 "Date.prototype.setTime",
25 "Date.prototype.setMilliseconds",
26 "Date.prototype.setSeconds",
27 "Date.prototype.setMinutes",
28 "Date.prototype.setHours",
29 "Date.prototype.setDate",
30 "Date.prototype.setMonth",
31 "Date.prototype.setFullYear",
32 "Date.prototype.setYear"
35 var o = new Object();
36 for (var i = 0; i < functionNames.length; i++) {
37 var testFunctionName = "o.__proto__." + functionNames[i].split('.')[2];
38 eval(testFunctionName + " = " + functionNames[i]);
39 shouldThrow(testFunctionName + "()", '"TypeError: Type error"');