]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Expressions/instanceof-005-n.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma_2 / Expressions / instanceof-005-n.js
1 /**
2 * File Name: instanceof-001.js
3 * ECMA Section: 11.8.6
4 * Description:
5 *
6 * RelationalExpression instanceof Identifier
7 *
8 * Author: christine@netscape.com
9 * Date: 2 September 1998
10 */
11 var SECTION = "instanceof-001";
12 var VERSION = "ECMA_2";
13 var TITLE = "instanceof"
14
15 startTest();
16 writeHeaderToLog( SECTION + " "+ TITLE);
17
18 var tc = 0;
19 var testcases = new Array();
20
21 function InstanceOf( object_1, object_2, expect ) {
22 result = object_1 instanceof object_2;
23
24 testcases[tc++] = new TestCase(
25 SECTION,
26 "(" + object_1 + ") instanceof " + object_2,
27 expect,
28 result );
29 }
30
31 function Gen3(value) {
32 this.value = value;
33 this.generation = 3;
34 this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
35 }
36 Gen3.name = 3;
37 Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
38
39 function Gen2(value) {
40 this.value = value;
41 this.generation = 2;
42 }
43 Gen2.name = 2;
44 Gen2.prototype = new Gen3();
45
46 function Gen1(value) {
47 this.value = value;
48 this.generation = 1;
49 }
50 Gen1.name = 1;
51 Gen1.prototype = new Gen2();
52
53 function Gen0(value) {
54 this.value = value;
55 this.generation = 0;
56 }
57 Gen0.name = 0;
58 Gen0.prototype = new Gen1();
59
60
61 function GenA(value) {
62 this.value = value;
63 this.generation = "A";
64 this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
65
66 }
67 GenA.prototype = new Gen0();
68 GenA.name = "A";
69
70 function GenB(value) {
71 this.value = value;
72 this.generation = "B";
73 this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
74 }
75 GenB.name = "B"
76 GenB.prototype = void 0;
77
78
79 // Identifier is a function, prototype of Identifier is not an object
80
81 InstanceOf( new GenB(), GenB, false );
82
83
84 test();