Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: test/mjsunit/date-parse.js

Issue 1704016: Added support for ES5 date time string format to Date.parse. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/dateparser-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/dateparser-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698