MCPcopy Index your code
hub / github.com/nodejs/node / TestExceptions

Function TestExceptions

deps/v8/test/mjsunit/instanceof.js:61–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59
60
61function TestExceptions() {
62 function F() { }
63 var items = [ 1, new Number(42),
64 true,
65 'string', new String('hest'),
66 {}, [],
67 F, new F(),
68 Object, String ];
69
70 var exceptions = 0;
71 var instanceofs = 0;
72
73 for (var i = 0; i < items.length; i++) {
74 for (var j = 0; j < items.length; j++) {
75 try {
76 if (items[i] instanceof items[j]) instanceofs++;
77 } catch (e) {
78 assertTrue(e instanceof TypeError);
79 exceptions++;
80 }
81 }
82 }
83 assertEquals(10, instanceofs);
84 assertEquals(88, exceptions);
85
86 // Make sure to throw an exception if the function prototype
87 // isn't a proper JavaScript object.
88 function G() { }
89 G.prototype = undefined;
90 assertThrows("({} instanceof G)");
91}
92
93TestExceptions();

Callers 1

instanceof.jsFile · 0.70

Calls 3

assertTrueFunction · 0.70
assertEqualsFunction · 0.50
assertThrowsFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…