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

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

Issue 8400056: Fix assertSame for unit testing harness. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | test/mjsunit/mjsunit.status » ('j') | test/mjsunit/mjsunit.status » ('J')
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (found === expected) { 224 if (found === expected) {
225 if (expected !== 0 || (1 / expected) == (1 / found)) return; 225 if (expected !== 0 || (1 / expected) == (1 / found)) return;
226 } else if (isNaN(expected) && isNaN(found)) { 226 } else if ((expected !== expected) && (found !== found)) {
rossberg 2011/10/28 09:05:18 Somebody should pull IEEE to court for their NaN s
227 return; 227 return;
228 } 228 }
229 fail(PrettyPrint(expected), found, name_opt); 229 fail(PrettyPrint(expected), found, name_opt);
230 }; 230 };
231 231
232 232
233 assertEquals = function assertEquals(expected, found, name_opt) { 233 assertEquals = function assertEquals(expected, found, name_opt) {
234 if (!deepEquals(found, expected)) { 234 if (!deepEquals(found, expected)) {
235 fail(PrettyPrint(expected), found, name_opt); 235 fail(PrettyPrint(expected), found, name_opt);
236 } 236 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Fix this when we ditch the old test runner. 346 // Fix this when we ditch the old test runner.
347 var message = "Fail" + "ure: unreachable"; 347 var message = "Fail" + "ure: unreachable";
348 if (name_opt) { 348 if (name_opt) {
349 message += " - " + name_opt; 349 message += " - " + name_opt;
350 } 350 }
351 throw new MjsUnitAssertionError(message); 351 throw new MjsUnitAssertionError(message);
352 }; 352 };
353 353
354 })(); 354 })();
355 355
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | test/mjsunit/mjsunit.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698