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

Side by Side Diff: test/mjsunit/date.js

Issue 1084018: Make the new Date test independent of the timezone in which it is run. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 assertEquals(date0, date1); 41 assertEquals(date0, date1);
42 assertEquals(date1, date2); 42 assertEquals(date1, date2);
43 assertEquals(date2, date3); 43 assertEquals(date2, date3);
44 44
45 // Test limits (+/-1e8 days from epoch) 45 // Test limits (+/-1e8 days from epoch)
46 46
47 var dMax = new Date(8.64e15); 47 var dMax = new Date(8.64e15);
48 assertEquals(8.64e15, dMax.getTime()); 48 assertEquals(8.64e15, dMax.getTime());
49 assertEquals(275760, dMax.getFullYear()); 49 assertEquals(275760, dMax.getFullYear());
50 assertEquals(8, dMax.getMonth()); 50 assertEquals(8, dMax.getMonth());
51 assertEquals(13, dMax.getDate()); 51 assertEquals(13, dMax.getUTCDate());
52 52
53 var dOverflow = new Date(8.64e15+1); 53 var dOverflow = new Date(8.64e15+1);
54 assertTrue(isNaN(dOverflow.getTime())); 54 assertTrue(isNaN(dOverflow.getTime()));
55 55
56 var dMin = new Date(-8.64e15); 56 var dMin = new Date(-8.64e15);
57 assertEquals(-8.64e15, dMin.getTime()); 57 assertEquals(-8.64e15, dMin.getTime());
58 assertEquals(-271821, dMin.getFullYear()); 58 assertEquals(-271821, dMin.getFullYear());
59 assertEquals(3, dMin.getMonth()); 59 assertEquals(3, dMin.getMonth());
60 assertEquals(20, dMin.getDate()); 60 assertEquals(20, dMin.getUTCDate());
61 61
62 var dUnderflow = new Date(-8.64e15-1); 62 var dUnderflow = new Date(-8.64e15-1);
63 assertTrue(isNaN(dUnderflow.getTime())); 63 assertTrue(isNaN(dUnderflow.getTime()));
64 64
65 65
66 // Tests inspired by js1_5/Date/regress-346363.js 66 // Tests inspired by js1_5/Date/regress-346363.js
67 67
68 // Year 68 // Year
69 var a = new Date(); 69 var a = new Date();
70 a.setFullYear(); 70 a.setFullYear();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999); 161 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999);
162 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000); 162 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000);
163 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1))); 163 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1)));
164 assertTrue(isNaN(Date.UTC(275760, 8, 14))); 164 assertTrue(isNaN(Date.UTC(275760, 8, 14)));
165 165
166 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999); 166 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999);
167 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000); 167 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000);
168 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999))); 168 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999)));
169 assertTrue(isNaN(Date.UTC(-271821, 3, 19))); 169 assertTrue(isNaN(Date.UTC(-271821, 3, 19)));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698