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

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

Issue 2848038: Fix bug in date code where -0 was not mapped to 0. This caused the ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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
« no previous file with comments | « src/runtime.cc ('k') | 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Test that toLocaleTimeString only returns the time portion of the 147 // Test that toLocaleTimeString only returns the time portion of the
148 // date without the timezone information. 148 // date without the timezone information.
149 function testToLocaleTimeString() { 149 function testToLocaleTimeString() {
150 var d = new Date(); 150 var d = new Date();
151 var s = d.toLocaleTimeString(); 151 var s = d.toLocaleTimeString();
152 assertEquals(8, s.length); 152 assertEquals(8, s.length);
153 } 153 }
154 154
155 testToLocaleTimeString(); 155 testToLocaleTimeString();
156 156
157 // Test that -0 is treated correctly in MakeDay.
158 var d = new Date();
159 assertDoesNotThrow("d.setDate(-0)");
160 assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0. -0)");
Erik Corry 2010/07/02 19:59:47 Perhaps we should also pass 0x40000000 and -0x4000
Mads Ager (chromium) 2010/07/02 20:07:07 Done.
161
157 162
158 // Modified test from WebKit 163 // Modified test from WebKit
159 // LayoutTests/fast/js/script-tests/date-utc-timeclip.js: 164 // LayoutTests/fast/js/script-tests/date-utc-timeclip.js:
160 165
161 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999); 166 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999);
162 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000); 167 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000);
163 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1))); 168 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1)));
164 assertTrue(isNaN(Date.UTC(275760, 8, 14))); 169 assertTrue(isNaN(Date.UTC(275760, 8, 14)));
165 170
166 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999); 171 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999);
167 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000); 172 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000);
168 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999))); 173 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999)));
169 assertTrue(isNaN(Date.UTC(-271821, 3, 19))); 174 assertTrue(isNaN(Date.UTC(-271821, 3, 19)));
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698