1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch11/11.8/11.8.6/S11.8.6_A6_T4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently 1.9 + * 1.10 + * @path ch11/11.8/11.8.6/S11.8.6_A6_T4.js 1.11 + * @description Checking if RelationalExpression is object 1.12 + */ 1.13 + 1.14 +MyFunct = function(){}; 1.15 +__my__funct = new MyFunct; 1.16 + 1.17 + 1.18 +//CHECK#1 1.19 +if (!(__my__funct instanceof MyFunct)){ 1.20 + $ERROR('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 1.21 +} 1.22 + 1.23 +//CHECK#2 1.24 +if (__my__funct instanceof Function){ 1.25 + $ERROR('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 1.26 +} 1.27 + 1.28 +//CHECK#3 1.29 +if (!(__my__funct instanceof Object)){ 1.30 + $ERROR('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 1.31 +} 1.32 + 1.33 +//CHECK#4 1.34 +try{ 1.35 + __my__funct instanceof __my__funct; 1.36 + $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 1.37 +} 1.38 +catch(e){ 1.39 + if (e instanceof TypeError !== true) { 1.40 + $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); 1.41 + } 1.42 +} 1.43 +