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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 | 211 |
212 function fail(expectedText, found, name_opt) { | 212 function fail(expectedText, found, name_opt) { |
213 var message = "Fail" + "ure"; | 213 var message = "Fail" + "ure"; |
214 if (name_opt) { | 214 if (name_opt) { |
215 // Fix this when we ditch the old test runner. | 215 // Fix this when we ditch the old test runner. |
216 message += " (" + name_opt + ")"; | 216 message += " (" + name_opt + ")"; |
217 } | 217 } |
218 | 218 |
219 message += ": expected <" + expectedText + | 219 var foundText = PrettyPrint(found); |
220 "> found <" + PrettyPrint(found) + ">"; | 220 if (expectedText.length <= 40 && foundText.length <= 40) { |
| 221 message += ": expected <" + expectedText + "> found <" + foundText + ">"; |
| 222 } else { |
| 223 message += ":\nexpected:\n" + expectedText + "\nfound:\n" + foundText; |
| 224 } |
221 throw new MjsUnitAssertionError(message); | 225 throw new MjsUnitAssertionError(message); |
222 } | 226 } |
223 | 227 |
224 | 228 |
225 function deepObjectEquals(a, b) { | 229 function deepObjectEquals(a, b) { |
226 var aProps = Object.keys(a); | 230 var aProps = Object.keys(a); |
227 aProps.sort(); | 231 aProps.sort(); |
228 var bProps = Object.keys(b); | 232 var bProps = Object.keys(b); |
229 bProps.sort(); | 233 bProps.sort(); |
230 if (!deepEquals(aProps, bProps)) { | 234 if (!deepEquals(aProps, bProps)) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 if (sync_opt === undefined) sync_opt = ""; | 464 if (sync_opt === undefined) sync_opt = ""; |
461 assertTrue(OptimizationStatus(fun, sync_opt) !== 1, name_opt); | 465 assertTrue(OptimizationStatus(fun, sync_opt) !== 1, name_opt); |
462 } | 466 } |
463 | 467 |
464 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 468 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { |
465 if (sync_opt === undefined) sync_opt = ""; | 469 if (sync_opt === undefined) sync_opt = ""; |
466 assertTrue(OptimizationStatus(fun, sync_opt) !== 2, name_opt); | 470 assertTrue(OptimizationStatus(fun, sync_opt) !== 2, name_opt); |
467 } | 471 } |
468 | 472 |
469 })(); | 473 })(); |
OLD | NEW |