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

Side by Side Diff: test/webkit/date-parse-comments-test.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions
6 // are met:
7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24 description(
25 "test of JavaScript date parsing (comments in parentheses)"
26 );
27
28 function testDateParse(date, numericResult)
29 {
30 if (numericResult == "NaN") {
31 shouldBeNaN('Date.parse("' + date + '")');
32 shouldBeNaN('Date.parse("' + date.toUpperCase() + '")');
33 shouldBeNaN('Date.parse("' + date.toLowerCase() + '")');
34 } else {
35 shouldBeTrue('Date.parse("' + date + '") == ' + numericResult);
36 shouldBeTrue('Date.parse("' + date.toUpperCase() + '") == ' + numericRes ult);
37 shouldBeTrue('Date.parse("' + date.toLowerCase() + '") == ' + numericRes ult);
38 }
39 }
40
41 var timeZoneOffset = Date.parse(" Dec 25 1995 1:30 ") - Date.parse(" Dec 25 1995 1:30 GMT ");
42
43 testDateParse("Dec ((27) 26 (24)) 25 1995 1:30 PM UTC", "819898200000");
44 testDateParse("Dec 25 1995 1:30 PM UTC (", "819898200000");
45 testDateParse("Dec 25 1995 1:30 (PM)) UTC", "NaN");
46 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) GMT (EST)", "819849600000");
47 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996)", "819849600000 + timeZoneOffs et");
48
49 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 (1:40) GMT (EST)", "81985 5000000");
50 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 (1:40)", "819855000000 + timeZoneOffset");
51 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 ", "819855000000 + timeZo neOffset");
52 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 AM (1:40 PM) GMT (EST)", "819855000000");
53 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 AM (1:40 PM)", "819855000 000 + timeZoneOffset");
54 testDateParse("Dec 25 1995 1:30( )AM (PM)", "NaN");
55 testDateParse("Dec 25 1995 1:30 AM (PM)", "819855000000 + timeZoneOffset");
56
57 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 13:30 (13:40) GMT (PST)", "819 898200000");
58 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 13:30 (13:40)", "819898200000 + timeZoneOffset");
59 testDateParse('(Nov) Dec (24) 25 (26) 13:30 (13:40) 1995 (1996)', "819898200000 + timeZoneOffset");
60 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 13:30 (13:40) ", "819898200000 + timeZoneOffset");
61 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 (1:40) PM (AM) GMT (PST)" , "819898200000");
62 testDateParse("(Nov) Dec (24) 25 (26) 1995 (1996) 1:30 (1:40) PM (AM)", "8198982 00000 + timeZoneOffset");
63 testDateParse("Dec 25 1995 1:30(AM)PM", "NaN");
64 testDateParse("Dec 25 1995 1:30 (AM)PM ", "819898200000 + timeZoneOffset");
65
66 testDateParse("Dec 25 1995 (PDT)UTC(PST)", "819849600000");
67 testDateParse("Dec 25 1995 (PDT)UT(PST)", "819849600000");
68 testDateParse("Dec 25 1995 (UTC)PST(GMT)", "819878400000");
69 testDateParse("Dec 25 1995 (UTC)PDT(GMT)", "819874800000");
70
71 testDateParse("Dec 25 1995 1:30 (PDT)UTC(PST)", "819855000000");
72 testDateParse("Dec 25 1995 1:30 (PDT)UT(PST)", "819855000000");
73 testDateParse("Dec 25 1995 1:30 (UTC)PST(GMT)", "819883800000");
74 testDateParse("Dec 25 1995 1:30 (UTC)PDT(GMT)", "819880200000");
75
76 testDateParse("Dec 25 1995 1:30 (AM) PM (PST) UTC", "819898200000");
77 testDateParse("Dec 25 1995 1:30 PM (AM) (PST) UT", "819898200000");
78 testDateParse("Dec 25 1995 1:30 PM (AM) (UTC) PST", "819927000000");
79 testDateParse("Dec 25 1995 1:30 (AM) PM PDT (UTC)", "819923400000");
80
81 testDateParse("Dec 25 1995 XXX (GMT)", "NaN");
82 testDateParse("Dec 25 1995 1:30 XXX (GMT)", "NaN");
83
84 testDateParse("Dec 25 1995 1:30 U(TC)", "NaN");
85 testDateParse("Dec 25 1995 1:30 V(UTC)", "NaN");
86 testDateParse("Dec 25 1995 1:30 (UTC)W", "NaN");
87 testDateParse("Dec 25 1995 1:30 (GMT)X", "NaN");
88
89 testDateParse("Dec 25 1995 0:30 (PM) GMT", "819851400000");
90 testDateParse("Dec 25 1995 (1)0:30 AM GMT", "819851400000");
91 testDateParse("Dec 25 1995 (1)0:30 PM GMT", "819894600000");
92
93 testDateParse("Anf(Dec) 25 1995 GMT", "NaN");
94
95 testDateParse("(Sat) Wed (Nov) Dec (Nov) 25 1995 1:30 GMT", "819855000000");
96 testDateParse("Wed (comment 1) (comment 2) Dec 25 1995 1:30 GMT", "819855000000" );
97 testDateParse("Wed(comment 1) (comment 2) Dec 25 1995 1:30 GMT", "819855000000") ;
98 testDateParse("We(comment 1) (comment 2) Dec 25 1995 1:30 GMT", "819855000000");
OLDNEW
« no previous file with comments | « test/webkit/date-daysfrom1970-overflow-expected.txt ('k') | test/webkit/date-parse-comments-test-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698