| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '10.1.3.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
var SECTION = "10.1.3"; |
| 17 |
var VERSION = "ECMA_1"; |
| 18 |
var TITLE = "Variable instantiation"; |
| 19 |
var BUGNUMBER = "20256"; |
| 20 |
startTest(); |
| 21 |
|
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
new TestCase(SECTION, |
| 28 |
"function t() { return \"first\" };" + |
| 29 |
"function t() { return \"second\" };t() ", |
| 30 |
"second", |
| 31 |
eval("function t() { return \"first\" };" + |
| 32 |
"function t() { return \"second\" };t()")); |
| 33 |
|
| 34 |
|
| 35 |
new TestCase(SECTION, |
| 36 |
"var t; function t(){}; typeof(t)", |
| 37 |
"function", |
| 38 |
eval("var t; function t(){}; typeof(t)")); |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
new TestCase(SECTION, |
| 44 |
"function t1(a,b) { return b; }; t1( 4 );", |
| 45 |
void 0, |
| 46 |
eval("function t1(a,b) { return b; }; t1( 4 );") ); |
| 47 |
|
| 48 |
new TestCase(SECTION, |
| 49 |
"function t1(a,b) { return a; }; t1(4);", |
| 50 |
4, |
| 51 |
eval("function t1(a,b) { return a; }; t1(4)")); |
| 52 |
|
| 53 |
new TestCase(SECTION, |
| 54 |
"function t1(a,b) { return a; }; t1();", |
| 55 |
void 0, |
| 56 |
eval("function t1(a,b) { return a; }; t1()")); |
| 57 |
|
| 58 |
new TestCase(SECTION, |
| 59 |
"function t1(a,b) { return a; }; t1(1,2,4);", |
| 60 |
1, |
| 61 |
eval("function t1(a,b) { return a; }; t1(1,2,4)")); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
new TestCase(SECTION, |
| 76 |
"function t1(a,b) { return a; }; t1( false, true );", |
| 77 |
false, |
| 78 |
eval("function t1(a,b) { return a; }; t1( false, true );")); |
| 79 |
|
| 80 |
new TestCase(SECTION, |
| 81 |
"function t1(a,b) { return b; }; t1( false, true );", |
| 82 |
true, |
| 83 |
eval("function t1(a,b) { return b; }; t1( false, true );")); |
| 84 |
|
| 85 |
new TestCase(SECTION, |
| 86 |
"function t1(a,b) { return a+b; }; t1( 4, 2 );", |
| 87 |
6, |
| 88 |
eval("function t1(a,b) { return a+b; }; t1( 4, 2 );")); |
| 89 |
|
| 90 |
new TestCase(SECTION, |
| 91 |
"function t1(a,b) { return a+b; }; t1( 4 );", |
| 92 |
Number.NaN, |
| 93 |
eval("function t1(a,b) { return a+b; }; t1( 4 );")); |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
new TestCase(SECTION, |
| 98 |
"function t() { return 'function' };" + |
| 99 |
"var t = 'variable'; typeof(t)", |
| 100 |
"string", |
| 101 |
eval("function t() { return 'function' };" + |
| 102 |
"var t = 'variable'; typeof(t)")); |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
new TestCase(SECTION, |
| 107 |
"function t1(a,b) { var a = b; return a; } t1(1,3);", |
| 108 |
3, |
| 109 |
eval("function t1(a, b){ var a = b; return a;}; t1(1,3)")); |
| 110 |
|
| 111 |
new TestCase(SECTION, |
| 112 |
"function t2(a,b) { this.a = b; } x = new t2(1,3); x.a", |
| 113 |
3, |
| 114 |
eval("function t2(a,b) { this.a = b; };" + |
| 115 |
"x = new t2(1,3); x.a")); |
| 116 |
|
| 117 |
new TestCase(SECTION, |
| 118 |
"function t2(a,b) { this.a = a; } x = new t2(1,3); x.a", |
| 119 |
1, |
| 120 |
eval("function t2(a,b) { this.a = a; };" + |
| 121 |
"x = new t2(1,3); x.a")); |
| 122 |
|
| 123 |
new TestCase(SECTION, |
| 124 |
"function t2(a,b) { this.a = b; this.b = a; } " + |
| 125 |
"x = new t2(1,3);x.a;", |
| 126 |
3, |
| 127 |
eval("function t2(a,b) { this.a = b; this.b = a; };" + |
| 128 |
"x = new t2(1,3);x.a;")); |
| 129 |
|
| 130 |
new TestCase(SECTION, |
| 131 |
"function t2(a,b) { this.a = b; this.b = a; }" + |
| 132 |
"x = new t2(1,3);x.b;", |
| 133 |
1, |
| 134 |
eval("function t2(a,b) { this.a = b; this.b = a; };" + |
| 135 |
"x = new t2(1,3);x.b;") ); |
| 136 |
|
| 137 |
test(); |