()
| 59 | |
| 60 | |
| 61 | function 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 | |
| 93 | TestExceptions(); |
no test coverage detected
searching dependent graphs…