/webkit/LayoutTests/fast/js/sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.3/S15.9.3.1_A1_T4.html

https://github.com/blackberry/WebKit-Smartphone · HTML · 309 lines · 246 code · 63 blank · 0 comment · 0 complexity · c1b0bce6ab9783d71cbd6d597e71b6d8 MD5 · raw file

  1. <html>
  2. <head>
  3. <meta charset='utf-8'>
  4. <style>
  5. .pass {
  6. font-weight: bold;
  7. color: green;
  8. }
  9. .fail {
  10. font-weight: bold;
  11. color: red;
  12. }
  13. </style>
  14. <script>
  15. if (window.layoutTestController)
  16. layoutTestController.dumpAsText();
  17. function SputnikError(message)
  18. {
  19. this.message = message;
  20. }
  21. SputnikError.prototype.toString = function ()
  22. {
  23. return 'SputnikError: ' + this.message;
  24. };
  25. var sputnikException;
  26. function testPrint(msg)
  27. {
  28. var span = document.createElement("span");
  29. document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
  30. span.innerHTML = msg + '<br />';
  31. }
  32. function escapeHTML(text)
  33. {
  34. return text.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;");
  35. }
  36. function printTestPassed(msg)
  37. {
  38. testPrint('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
  39. }
  40. function printTestFailed(msg)
  41. {
  42. testPrint('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
  43. }
  44. function testFailed(msg)
  45. {
  46. throw new SputnikError(msg);
  47. }
  48. var successfullyParsed = false;
  49. </script>
  50. </head>
  51. <body>
  52. <p>S15.9.3.1_A1_T4</p>
  53. <div id='console'></div>
  54. <script>
  55. try {
  56. /**
  57. * @name: S15.9.3.1_A1_T4;
  58. * @section: 15.9.3.1;
  59. * @assertion: When Date is called as part of a new expression it is
  60. * a constructor: it initializes the newly created object;
  61. * @description: 5 arguments, (year, month, date, hours, minutes);
  62. */
  63. if (typeof new Date(1899, 11, 31, 23, 59) !== "object") {
  64. testFailed("#1.1: typeof new Date(1899, 11, 31, 23, 59) should be 'object'");
  65. }
  66. if (new Date(1899, 11, 31, 23, 59) === undefined) {
  67. testFailed("#1.2: new Date(1899, 11, 31, 23, 59) should not be undefined");
  68. }
  69. var x13 = new Date(1899, 11, 31, 23, 59);
  70. if(typeof x13 !== "object"){
  71. testFailed("#1.3: typeof new Date(1899, 11, 31, 23, 59) should be 'object'");
  72. }
  73. var x14 = new Date(1899, 11, 31, 23, 59);
  74. if(x14 === undefined){
  75. testFailed("#1.4: new Date(1899, 11, 31, 23, 59) should not be undefined");
  76. }
  77. if (typeof new Date(1899, 12, 1, 0, 0) !== "object") {
  78. testFailed("#2.1: typeof new Date(1899, 12, 1, 0, 0) should be 'object'");
  79. }
  80. if (new Date(1899, 12, 1, 0, 0) === undefined) {
  81. testFailed("#2.2: new Date(1899, 12, 1, 0, 0) should not be undefined");
  82. }
  83. var x23 = new Date(1899, 12, 1, 0, 0);
  84. if(typeof x23 !== "object"){
  85. testFailed("#2.3: typeof new Date(1899, 12, 1, 0, 0) should be 'object'");
  86. }
  87. var x24 = new Date(1899, 12, 1, 0, 0);
  88. if(x24 === undefined){
  89. testFailed("#2.4: new Date(1899, 12, 1, 0, 0) should not be undefined");
  90. }
  91. if (typeof new Date(1900, 0, 1, 0, 0) !== "object") {
  92. testFailed("#3.1: typeof new Date(1900, 0, 1, 0, 0) should be 'object'");
  93. }
  94. if (new Date(1900, 0, 1, 0, 0) === undefined) {
  95. testFailed("#3.2: new Date(1900, 0, 1, 0, 0) should not be undefined");
  96. }
  97. var x33 = new Date(1900, 0, 1, 0, 0);
  98. if(typeof x33 !== "object"){
  99. testFailed("#3.3: typeof new Date(1900, 0, 1, 0, 0) should be 'object'");
  100. }
  101. var x34 = new Date(1900, 0, 1, 0, 0);
  102. if(x34 === undefined){
  103. testFailed("#3.4: new Date(1900, 0, 1, 0, 0) should not be undefined");
  104. }
  105. if (typeof new Date(1969, 11, 31, 23, 59) !== "object") {
  106. testFailed("#4.1: typeof new Date(1969, 11, 31, 23, 59) should be 'object'");
  107. }
  108. if (new Date(1969, 11, 31, 23, 59) === undefined) {
  109. testFailed("#4.2: new Date(1969, 11, 31, 23, 59) should not be undefined");
  110. }
  111. var x43 = new Date(1969, 11, 31, 23, 59);
  112. if(typeof x43 !== "object"){
  113. testFailed("#4.3: typeof new Date(1969, 11, 31, 23, 59) should be 'object'");
  114. }
  115. var x44 = new Date(1969, 11, 31, 23, 59);
  116. if(x44 === undefined){
  117. testFailed("#4.4: new Date(1969, 11, 31, 23, 59) should not be undefined");
  118. }
  119. if (typeof new Date(1969, 12, 1, 0, 0) !== "object") {
  120. testFailed("#5.1: typeof new Date(1969, 12, 1, 0, 0) should be 'object'");
  121. }
  122. if (new Date(1969, 12, 1, 0, 0) === undefined) {
  123. testFailed("#5.2: new Date(1969, 12, 1, 0, 0) should not be undefined");
  124. }
  125. var x53 = new Date(1969, 12, 1, 0, 0);
  126. if(typeof x53 !== "object"){
  127. testFailed("#5.3: typeof new Date(1969, 12, 1, 0, 0) should be 'object'");
  128. }
  129. var x54 = new Date(1969, 12, 1, 0, 0);
  130. if(x54 === undefined){
  131. testFailed("#5.4: new Date(1969, 12, 1, 0, 0) should not be undefined");
  132. }
  133. if (typeof new Date(1970, 0, 1, 0, 0) !== "object") {
  134. testFailed("#6.1: typeof new Date(1970, 0, 1, 0, 0) should be 'object'");
  135. }
  136. if (new Date(1970, 0, 1, 0, 0) === undefined) {
  137. testFailed("#6.2: new Date(1970, 0, 1, 0, 0) should not be undefined");
  138. }
  139. var x63 = new Date(1970, 0, 1, 0, 0);
  140. if(typeof x63 !== "object"){
  141. testFailed("#6.3: typeof new Date(1970, 0, 1, 0, 0) should be 'object'");
  142. }
  143. var x64 = new Date(1970, 0, 1, 0, 0);
  144. if(x64 === undefined){
  145. testFailed("#6.4: new Date(1970, 0, 1, 0, 0) should not be undefined");
  146. }
  147. if (typeof new Date(1999, 11, 31, 23, 59) !== "object") {
  148. testFailed("#7.1: typeof new Date(1999, 11, 31, 23, 59) should be 'object'");
  149. }
  150. if (new Date(1999, 11, 31, 23, 59) === undefined) {
  151. testFailed("#7.2: new Date(1999, 11, 31, 23, 59) should not be undefined");
  152. }
  153. var x73 = new Date(1999, 11, 31, 23, 59);
  154. if(typeof x73 !== "object"){
  155. testFailed("#7.3: typeof new Date(1999, 11, 31, 23, 59) should be 'object'");
  156. }
  157. var x74 = new Date(1999, 11, 31, 23, 59);
  158. if(x74 === undefined){
  159. testFailed("#7.4: new Date(1999, 11, 31, 23, 59) should not be undefined");
  160. }
  161. if (typeof new Date(1999, 12, 1, 0, 0) !== "object") {
  162. testFailed("#8.1: typeof new Date(1999, 12, 1, 0, 0) should be 'object'");
  163. }
  164. if (new Date(1999, 12, 1, 0, 0) === undefined) {
  165. testFailed("#8.2: new Date(1999, 12, 1, 0, 0) should not be undefined");
  166. }
  167. var x83 = new Date(1999, 12, 1, 0, 0);
  168. if(typeof x83 !== "object"){
  169. testFailed("#8.3: typeof new Date(1999, 12, 1, 0, 0) should be 'object'");
  170. }
  171. var x84 = new Date(1999, 12, 1, 0, 0);
  172. if(x84 === undefined){
  173. testFailed("#8.4: new Date(1999, 12, 1, 0, 0) should not be undefined");
  174. }
  175. if (typeof new Date(2000, 0, 1, 0, 0) !== "object") {
  176. testFailed("#9.1: typeof new Date(2000, 0, 1, 0, 0) should be 'object'");
  177. }
  178. if (new Date(2000, 0, 1, 0, 0) === undefined) {
  179. testFailed("#9.2: new Date(2000, 0, 1, 0, 0) should not be undefined");
  180. }
  181. var x93 = new Date(2000, 0, 1, 0, 0);
  182. if(typeof x93 !== "object"){
  183. testFailed("#9.3: typeof new Date(2000, 0, 1, 0, 0) should be 'object'");
  184. }
  185. var x94 = new Date(2000, 0, 1, 0, 0);
  186. if(x94 === undefined){
  187. testFailed("#9.4: new Date(2000, 0, 1, 0, 0) should not be undefined");
  188. }
  189. if (typeof new Date(2099, 11, 31, 23, 59) !== "object") {
  190. testFailed("#10.1: typeof new Date(2099, 11, 31, 23, 59) should be 'object'");
  191. }
  192. if (new Date(2099, 11, 31, 23, 59) === undefined) {
  193. testFailed("#10.2: new Date(2099, 11, 31, 23, 59) should not be undefined");
  194. }
  195. var x103 = new Date(2099, 11, 31, 23, 59);
  196. if(typeof x103 !== "object"){
  197. testFailed("#10.3: typeof new Date(2099, 11, 31, 23, 59) should be 'object'");
  198. }
  199. var x104 = new Date(2099, 11, 31, 23, 59);
  200. if(x104 === undefined){
  201. testFailed("#10.4: new Date(2099, 11, 31, 23, 59) should not be undefined");
  202. }
  203. if (typeof new Date(2099, 12, 1, 0, 0) !== "object") {
  204. testFailed("#11.1: typeof new Date(2099, 12, 1, 0, 0) should be 'object'");
  205. }
  206. if (new Date(2099, 12, 1, 0, 0) === undefined) {
  207. testFailed("#11.2: new Date(2099, 12, 1, 0, 0) should not be undefined");
  208. }
  209. var x113 = new Date(2099, 12, 1, 0, 0);
  210. if(typeof x113 !== "object"){
  211. testFailed("#11.3: typeof new Date(2099, 12, 1, 0, 0) should be 'object'");
  212. }
  213. var x114 = new Date(2099, 12, 1, 0, 0);
  214. if(x114 === undefined){
  215. testFailed("#11.4: new Date(2099, 12, 1, 0, 0) should not be undefined");
  216. }
  217. if (typeof new Date(2100, 0, 1, 0, 0) !== "object") {
  218. testFailed("#12.1: typeof new Date(2100, 0, 1, 0, 0) should be 'object'");
  219. }
  220. if (new Date(2100, 0, 1, 0, 0) === undefined) {
  221. testFailed("#12.2: new Date(2100, 0, 1, 0, 0) should not be undefined");
  222. }
  223. var x123 = new Date(2100, 0, 1, 0, 0);
  224. if(typeof x123 !== "object"){
  225. testFailed("#12.3: typeof new Date(2100, 0, 1, 0, 0) should be 'object'");
  226. }
  227. var x124 = new Date(2100, 0, 1, 0, 0);
  228. if(x124 === undefined){
  229. testFailed("#12.4: new Date(2100, 0, 1, 0, 0) should not be undefined");
  230. }
  231. } catch (ex) {
  232. sputnikException = ex;
  233. }
  234. var successfullyParsed = true;
  235. </script>
  236. <script>
  237. if (!successfullyParsed)
  238. printTestFailed('successfullyParsed is not set');
  239. else if (sputnikException)
  240. printTestFailed(sputnikException);
  241. else
  242. printTestPassed("");
  243. testPrint('<br /><span class="pass">TEST COMPLETE</span>');
  244. </script>
  245. </body>
  246. </html>