In .:
[mono.git] / mcs / class / Microsoft.JScript / Test / Mozilla / ecma_2 / Expressions / instanceof-003-n.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /**
3  *  File Name:          instanceof-001.js
4  *  ECMA Section:       11.8.6
5  *  Description:
6  *
7  *  RelationalExpression instanceof Identifier
8  *
9  *  Author:             christine@netscape.com
10  *  Date:               2 September 1998
11  */
12 var SECTION = "instanceof-003-n";
13 var VERSION = "ECMA_2";
14 var TITLE   = "instanceof"
15
16 startTest();
17 writeHeaderToLog( SECTION + " "+ TITLE);
18
19 function InstanceOf( object_1, object_2, expect ) {
20
21   result = object_1 instanceof object_2;
22
23   new TestCase(
24     SECTION,
25     "(" + object_1 + ") instanceof " + object_2,
26     expect,
27     result );
28 }
29
30 function Gen3(value) {
31   this.value = value;
32   this.generation = 3;
33   this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
34 }
35 Gen3.name = 3;
36 Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
37
38 function Gen2(value) {
39   this.value = value;
40   this.generation = 2;
41 }
42 Gen2.name = 2;
43 Gen2.prototype = new Gen3();
44
45 function Gen1(value) {
46   this.value = value;
47   this.generation = 1;
48 }
49 Gen1.name = 1;
50 Gen1.prototype = new Gen2();
51
52 function Gen0(value) {
53   this.value = value;
54   this.generation = 0;
55 }
56 Gen0.name = 0;
57 Gen0.prototype = new Gen1();
58
59
60 function GenA(value) {
61   this.value = value;
62   this.generation = "A";
63   this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
64
65 }
66 GenA.prototype = new Gen0();
67 GenA.name = "A";
68
69 function GenB(value) {
70   this.value = value;
71   this.generation = "B";
72   this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
73 }
74 GenB.name = "B"
75 GenB.prototype = void 0;
76
77 // Identifier is not a function
78 DESCRIPTION = "Identifier is not a function";
79 EXPECTED = "error";
80
81 InstanceOf( true, true, "error" );
82
83 test();