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

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

Issue 9630009: Implement Object.is and Number.is[Finite,NaN] functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 8 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
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 if (objectClass == "String" || objectClass == "Number" || 215 if (objectClass == "String" || objectClass == "Number" ||
216 objectClass == "Boolean" || objectClass == "Date") { 216 objectClass == "Boolean" || objectClass == "Date") {
217 if (a.valueOf() !== b.valueOf()) return false; 217 if (a.valueOf() !== b.valueOf()) return false;
218 } 218 }
219 return deepObjectEquals(a, b); 219 return deepObjectEquals(a, b);
220 } 220 }
221 221
222 222
223 assertSame = function assertSame(expected, found, name_opt) { 223 assertSame = function assertSame(expected, found, name_opt) {
224 // TODO(mstarzinger): We should think about using Harmony's egal operator
225 // or the function equivalent Object.is() here.
224 if (found === expected) { 226 if (found === expected) {
225 if (expected !== 0 || (1 / expected) == (1 / found)) return; 227 if (expected !== 0 || (1 / expected) == (1 / found)) return;
226 } else if ((expected !== expected) && (found !== found)) { 228 } else if ((expected !== expected) && (found !== found)) {
227 return; 229 return;
228 } 230 }
229 fail(PrettyPrint(expected), found, name_opt); 231 fail(PrettyPrint(expected), found, name_opt);
230 }; 232 };
231 233
232 234
233 assertEquals = function assertEquals(expected, found, name_opt) { 235 assertEquals = function assertEquals(expected, found, name_opt) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Fix this when we ditch the old test runner. 348 // Fix this when we ditch the old test runner.
347 var message = "Fail" + "ure: unreachable"; 349 var message = "Fail" + "ure: unreachable";
348 if (name_opt) { 350 if (name_opt) {
349 message += " - " + name_opt; 351 message += " - " + name_opt;
350 } 352 }
351 throw new MjsUnitAssertionError(message); 353 throw new MjsUnitAssertionError(message);
352 }; 354 };
353 355
354 })(); 356 })();
355 357
OLDNEW
« src/v8natives.js ('K') | « src/v8natives.js ('k') | test/mjsunit/number-is.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698