blob: 95d7ab7d8a7f064ae5df11cf62e5a4a75c71c72d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S11.8.6_A6_T4;
* @section: 11.8.6;
* @assertion: Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently;
* @description: Checking if RelationalExpression is object;
*/
// Converted for Test262 from original Sputnik source
ES5Harness.registerTest( {
id: "S11.8.6_A6_T4",
path: "TestCases/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T4.js",
assertion: "Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the \"instanceof\" operator consequently",
description: "Checking if RelationalExpression is object",
test: function testcase() {
MyFunct = function(){};
__my__funct = new MyFunct;
//CHECK#1
if (!(__my__funct instanceof MyFunct)){
$ERROR('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
}
//CHECK#2
if (__my__funct instanceof Function){
$ERROR('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
}
//CHECK#3
if (!(__my__funct instanceof Object)){
$ERROR('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
}
//CHECK#4
try{
__my__funct instanceof __my__funct;
$ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
}
catch(e){
if (e instanceof TypeError !== true) {
$ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
}
}
}
});
|