Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/instanceof/S11.8.6_A6_T4.js

raw
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 $ERROR('#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 $ERROR('#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 $ERROR('#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 $ERROR('#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 $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
39 }
40 }