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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 // Success. | 314 // Success. |
315 return; | 315 return; |
316 } | 316 } |
317 throw new MjsUnitAssertionError("Did not throw exception"); | 317 throw new MjsUnitAssertionError("Did not throw exception"); |
318 }; | 318 }; |
319 | 319 |
320 | 320 |
321 assertInstanceof = function assertInstanceof(obj, type) { | 321 assertInstanceof = function assertInstanceof(obj, type) { |
322 if (!(obj instanceof type)) { | 322 if (!(obj instanceof type)) { |
323 var actualTypeName = null; | 323 var actualTypeName = null; |
324 var actualConstructor = Object.prototypeOf(obj).constructor; | 324 var actualConstructor = Object.getPrototypeOf(obj).constructor; |
Michael Starzinger
2012/06/25 09:56:45
How did that even ... ah forget it.
rossberg
2012/06/28 16:23:34
Great stuff, isn't it?
| |
325 if (typeof actualConstructor == "function") { | 325 if (typeof actualConstructor == "function") { |
326 actualTypeName = actualConstructor.name || String(actualConstructor); | 326 actualTypeName = actualConstructor.name || String(actualConstructor); |
327 } | 327 } |
328 fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + | 328 fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + |
329 (type.name || type) + ">" + | 329 (type.name || type) + ">" + |
330 (actualTypeName ? " but of < " + actualTypeName + ">" : "")); | 330 (actualTypeName ? " but of < " + actualTypeName + ">" : "")); |
331 } | 331 } |
332 }; | 332 }; |
333 | 333 |
334 | 334 |
(...skipping 13 matching lines...) Expand all Loading... | |
348 // Fix this when we ditch the old test runner. | 348 // Fix this when we ditch the old test runner. |
349 var message = "Fail" + "ure: unreachable"; | 349 var message = "Fail" + "ure: unreachable"; |
350 if (name_opt) { | 350 if (name_opt) { |
351 message += " - " + name_opt; | 351 message += " - " + name_opt; |
352 } | 352 } |
353 throw new MjsUnitAssertionError(message); | 353 throw new MjsUnitAssertionError(message); |
354 }; | 354 }; |
355 | 355 |
356 })(); | 356 })(); |
357 | 357 |
OLD | NEW |