| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 assertEquals(8, s.length); | 152 assertEquals(8, s.length); |
| 153 } | 153 } |
| 154 | 154 |
| 155 testToLocaleTimeString(); | 155 testToLocaleTimeString(); |
| 156 | 156 |
| 157 // Test that -0 is treated correctly in MakeDay. | 157 // Test that -0 is treated correctly in MakeDay. |
| 158 var d = new Date(); | 158 var d = new Date(); |
| 159 assertDoesNotThrow("d.setDate(-0)"); | 159 assertDoesNotThrow("d.setDate(-0)"); |
| 160 assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0, -0)"); | 160 assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0, -0)"); |
| 161 assertDoesNotThrow("new Date(0x40000000, 0x40000000, 0x40000000," + | 161 assertDoesNotThrow("new Date(0x40000000, 0x40000000, 0x40000000," + |
| 162 "0x40000000, 0x40000000, 0x40000000, 0x40000000)") | 162 "0x40000000, 0x40000000, 0x40000000, 0x40000000)"); |
| 163 assertDoesNotThrow("new Date(-0x40000001, -0x40000001, -0x40000001," + | 163 assertDoesNotThrow("new Date(-0x40000001, -0x40000001, -0x40000001," + |
| 164 "-0x40000001, -0x40000001, -0x40000001, -0x40000001)") | 164 "-0x40000001, -0x40000001, -0x40000001, -0x40000001)"); |
| 165 | 165 |
| 166 | 166 |
| 167 // Modified test from WebKit | 167 // Modified test from WebKit |
| 168 // LayoutTests/fast/js/script-tests/date-utc-timeclip.js: | 168 // LayoutTests/fast/js/script-tests/date-utc-timeclip.js: |
| 169 | 169 |
| 170 assertEquals(8639999999999999, Date.UTC(275760, 8, 12, 23, 59, 59, 999)); | 170 assertEquals(8639999999999999, Date.UTC(275760, 8, 12, 23, 59, 59, 999)); |
| 171 assertEquals(8640000000000000, Date.UTC(275760, 8, 13)); | 171 assertEquals(8640000000000000, Date.UTC(275760, 8, 13)); |
| 172 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1))); | 172 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1))); |
| 173 assertTrue(isNaN(Date.UTC(275760, 8, 14))); | 173 assertTrue(isNaN(Date.UTC(275760, 8, 14))); |
| 174 | 174 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 var hh = (i < 10) ? "0" + i : "" + i; | 306 var hh = (i < 10) ? "0" + i : "" + i; |
| 307 for (var j = 0; j < 60; j += 15) { | 307 for (var j = 0; j < 60; j += 15) { |
| 308 var mm = (j < 10) ? "0" + j : "" + j; | 308 var mm = (j < 10) ? "0" + j : "" + j; |
| 309 var ms = (i * 60 + j) * 60000; | 309 var ms = (i * 60 + j) * 60000; |
| 310 var string = "1972-03-28T23:50:03.500-" + hh + ":" + mm; | 310 var string = "1972-03-28T23:50:03.500-" + hh + ":" + mm; |
| 311 assertEquals(70674603500 + ms, Date.parse(string), string); | 311 assertEquals(70674603500 + ms, Date.parse(string), string); |
| 312 string = "1972-03-28T23:50:03.500+" + hh + ":" + mm; | 312 string = "1972-03-28T23:50:03.500+" + hh + ":" + mm; |
| 313 assertEquals(70674603500 - ms, Date.parse(string), string); | 313 assertEquals(70674603500 - ms, Date.parse(string), string); |
| 314 } | 314 } |
| 315 } | 315 } |
| OLD | NEW |