S11.8.6_A6_T4.js (1488B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Only Function objects implement [[HasInstance]] and can be proper 7 ShiftExpression for the "instanceof" operator consequently 8 es5id: 11.8.6_A6_T4 9 description: Checking if RelationalExpression is object 10 ---*/ 11 12 var MyFunct = function(){}; 13 var __my__funct = new MyFunct; 14 15 16 //CHECK#1 17 if (!(__my__funct instanceof MyFunct)){ 18 throw new Test262Error('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 19 } 20 21 //CHECK#2 22 if (__my__funct instanceof Function){ 23 throw new Test262Error('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 24 } 25 26 //CHECK#3 27 if (!(__my__funct instanceof Object)){ 28 throw new Test262Error('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 29 } 30 31 //CHECK#4 32 try{ 33 __my__funct instanceof __my__funct; 34 throw new Test262Error('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 35 } 36 catch(e){ 37 if (e instanceof TypeError !== true) { 38 throw new Test262Error('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 39 } 40 } 41 42 reportCompare(0, 0);