| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 testCasesPDT.forEach(testDateParse); | 247 testCasesPDT.forEach(testDateParse); |
| 248 testCasesLocalTime.forEach(testDateParseLocalTime); | 248 testCasesLocalTime.forEach(testDateParseLocalTime); |
| 249 testCasesMisc.forEach(testDateParseMisc); | 249 testCasesMisc.forEach(testDateParseMisc); |
| 250 | 250 |
| 251 | 251 |
| 252 // Test that we can parse our own date format. | 252 // Test that we can parse our own date format. |
| 253 // (Dates from 1970 to ~2070 with 95h steps.) | 253 // (Dates from 1970 to ~2070 with 95h steps.) |
| 254 for (var i = 0; i < 24 * 365 * 100; i += 95) { | 254 for (var i = 0; i < 24 * 365 * 100; i += 95) { |
| 255 var ms = i * (3600 * 1000); | 255 var ms = i * (3600 * 1000); |
| 256 var s = (new Date(ms)).toString(); | 256 var s = (new Date(ms)).toString(); |
| 257 assertEquals(ms, Date.parse(s), s); | 257 assertEquals(ms, Date.parse(s), "parse own: " + s); |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Negative tests. | 260 // Negative tests. |
| 261 var testCasesNegative = [ | 261 var testCasesNegative = [ |
| 262 'May 25 2008 1:30 (PM)) UTC', | 262 'May 25 2008 1:30 (PM)) UTC', |
| 263 'May 25 2008 1:30( )AM (PM)', | 263 'May 25 2008 1:30( )AM (PM)', |
| 264 'May 25 2008 AAA (GMT)']; | 264 'May 25 2008 AAA (GMT)']; |
| 265 | 265 |
| 266 testCasesNegative.forEach(function (s) { | 266 testCasesNegative.forEach(function (s) { |
| 267 assertTrue(isNaN(Date.parse(s)), s + " is not NaN."); | 267 assertTrue(isNaN(Date.parse(s)), s + " is not NaN."); |
| 268 }); | 268 }); |
| OLD | NEW |