| OLD | NEW |
| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 | 200 |
| 201 function PrettyPrintArrayElement(value, index, array) { | 201 function PrettyPrintArrayElement(value, index, array) { |
| 202 if (value === undefined && !(index in array)) return ""; | 202 if (value === undefined && !(index in array)) return ""; |
| 203 return PrettyPrint(value); | 203 return PrettyPrint(value); |
| 204 } | 204 } |
| 205 | 205 |
| 206 | 206 |
| 207 function fail(expectedText, found, name_opt) { | 207 function fail(expectedText, found, name_opt) { |
| 208 var message = "Fail" + "ure"; | 208 var message = "Fail" + "ure"; |
| 209 if (name_opt) { | 209 if (found) { |
| 210 // Fix this when we ditch the old test runner. | 210 message += ": expected <" + expectedText + |
| 211 message += " (" + name_opt + ")"; | 211 "> found <" + PrettyPrint(found) + ">"; |
| 212 if (name_opt) { |
| 213 // Fix this when we ditch the old test runner. |
| 214 message += " (" + name_opt + ")"; |
| 215 } |
| 216 } else { |
| 217 message += ": " + expectedText; |
| 212 } | 218 } |
| 213 | |
| 214 message += ": expected <" + expectedText + | |
| 215 "> found <" + PrettyPrint(found) + ">"; | |
| 216 throw new MjsUnitAssertionError(message); | 219 throw new MjsUnitAssertionError(message); |
| 217 } | 220 } |
| 218 | 221 |
| 219 | 222 |
| 220 function deepObjectEquals(a, b) { | 223 function deepObjectEquals(a, b) { |
| 221 var aProps = Object.keys(a); | 224 var aProps = Object.keys(a); |
| 222 aProps.sort(); | 225 aProps.sort(); |
| 223 var bProps = Object.keys(b); | 226 var bProps = Object.keys(b); |
| 224 bProps.sort(); | 227 bProps.sort(); |
| 225 if (!deepEquals(aProps, bProps)) { | 228 if (!deepEquals(aProps, bProps)) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 392 |
| 390 assertInstanceof = function assertInstanceof(obj, type) { | 393 assertInstanceof = function assertInstanceof(obj, type) { |
| 391 if (!(obj instanceof type)) { | 394 if (!(obj instanceof type)) { |
| 392 var actualTypeName = null; | 395 var actualTypeName = null; |
| 393 var actualConstructor = Object.getPrototypeOf(obj).constructor; | 396 var actualConstructor = Object.getPrototypeOf(obj).constructor; |
| 394 if (typeof actualConstructor === "function") { | 397 if (typeof actualConstructor === "function") { |
| 395 actualTypeName = actualConstructor.name || String(actualConstructor); | 398 actualTypeName = actualConstructor.name || String(actualConstructor); |
| 396 } | 399 } |
| 397 fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + | 400 fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + |
| 398 (type.name || type) + ">" + | 401 (type.name || type) + ">" + |
| 399 (actualTypeName ? " but of < " + actualTypeName + ">" : "")); | 402 (actualTypeName ? " but of <" + actualTypeName + ">" : "")); |
| 400 } | 403 } |
| 401 }; | 404 }; |
| 402 | 405 |
| 403 | 406 |
| 404 assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { | 407 assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { |
| 405 try { | 408 try { |
| 406 if (typeof code === 'function') { | 409 if (typeof code === 'function') { |
| 407 code(); | 410 code(); |
| 408 } else { | 411 } else { |
| 409 eval(code); | 412 eval(code); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 if (sync_opt === undefined) sync_opt = ""; | 458 if (sync_opt === undefined) sync_opt = ""; |
| 456 assertTrue(OptimizationStatus(fun, sync_opt) !== 1, name_opt); | 459 assertTrue(OptimizationStatus(fun, sync_opt) !== 1, name_opt); |
| 457 } | 460 } |
| 458 | 461 |
| 459 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 462 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { |
| 460 if (sync_opt === undefined) sync_opt = ""; | 463 if (sync_opt === undefined) sync_opt = ""; |
| 461 assertTrue(OptimizationStatus(fun, sync_opt) !== 2, name_opt); | 464 assertTrue(OptimizationStatus(fun, sync_opt) !== 2, name_opt); |
| 462 } | 465 } |
| 463 | 466 |
| 464 })(); | 467 })(); |
| OLD | NEW |