Index: test/mjsunit/date-parse.js |
=================================================================== |
--- test/mjsunit/date-parse.js (revision 4543) |
+++ test/mjsunit/date-parse.js (working copy) |
@@ -205,7 +205,6 @@ |
'Saturday, 01-Jan-00 01:00:00 PDT', |
'01 Jan 00 01:00 -0700']; |
- |
// Local time cases. |
var testCasesLocalTime = [ |
// Allow timezone ommision. |
@@ -233,7 +232,28 @@ |
['Saturday, 01-Jan-00 08:00 PM UT', 946756800000], |
['01 Jan 00 08:00 PM +0000', 946756800000]]; |
+// Test different version of the ES5 date time string format |
Mads Ager (chromium)
2010/04/29 13:24:01
End comments with period.
|
+var testCasesES5Misc = [ |
+ ['2000-01-01T08:00:00.000Z', 946713600000], |
+ ['2000-01-01T08:00:00Z', 946713600000], |
+ ['2000-01-01T08:00Z', 946713600000], |
+ ['2000-01T08:00:00.000Z', 946713600000], |
+ ['2000T08:00:00.000Z', 946713600000], |
+ ['2000T08:00Z', 946713600000], |
+ ['2000-01T00:00:00.000-08:00', 946713600000], |
+ ['2000-01T08:00:00.001Z', 946713600001], |
+ ['2000-01T08:00:00.099Z', 946713600099], |
+ ['2000-01T08:00:00.999Z', 946713600999], |
+ ['2000-01T00:00:00.001-08:00', 946713600001]]; |
+var testCasesES5MiscNegative = [ |
+ '2000-01-01TZ', |
+ '2000-01-01T60Z', |
+ '2000-01-01T60:60Z', |
+ '2000-01-0108:00Z', |
+ '2000-01-01T08Z']; |
+ |
+ |
// Run all the tests. |
testCasesUT.forEach(testDateParse); |
testCasesGMT.forEach(testDateParse); |
@@ -248,7 +268,13 @@ |
testCasesLocalTime.forEach(testDateParseLocalTime); |
testCasesMisc.forEach(testDateParseMisc); |
+// ES5 date time string format compliance |
Mads Ager (chromium)
2010/04/29 13:24:01
Ditto.
|
+testCasesES5Misc.forEach(testDateParseMisc); |
+testCasesES5MiscNegative.forEach(function (s) { |
+ assertTrue(isNaN(Date.parse(s)), s + " is not NaN."); |
+}); |
+ |
// Test that we can parse our own date format. |
// (Dates from 1970 to ~2070 with 150h steps.) |
for (var i = 0; i < 24 * 365 * 100; i += 150) { |