| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '12.10-1.js'; |
| 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 |
var SECTION = "12.10-1"; |
| 41 |
var VERSION = "ECMA_1"; |
| 42 |
startTest(); |
| 43 |
var TITLE = "The with statement"; |
| 44 |
|
| 45 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
new TestCase( SECTION, |
| 52 |
"with( new Number() ) { this +'' }", |
| 53 |
GLOBAL, |
| 54 |
eval("with( new Number() ) { this +'' }") ); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
new TestCase( |
| 60 |
SECTION, |
| 61 |
"var MYOB = new WithObject(true); with (MYOB) { parseInt() }", |
| 62 |
true, |
| 63 |
eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") ); |
| 64 |
|
| 65 |
new TestCase( |
| 66 |
SECTION, |
| 67 |
"var MYOB = new WithObject(false); with (MYOB) { NaN }", |
| 68 |
false, |
| 69 |
eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") ); |
| 70 |
|
| 71 |
new TestCase( |
| 72 |
SECTION, |
| 73 |
"var MYOB = new WithObject(NaN); with (MYOB) { Infinity }", |
| 74 |
Number.NaN, |
| 75 |
eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") ); |
| 76 |
|
| 77 |
new TestCase( |
| 78 |
SECTION, |
| 79 |
"var MYOB = new WithObject(false); with (MYOB) { }; Infinity", |
| 80 |
Number.POSITIVE_INFINITY, |
| 81 |
eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") ); |
| 82 |
|
| 83 |
|
| 84 |
new TestCase( |
| 85 |
SECTION, |
| 86 |
"var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }", |
| 87 |
Number.POSITIVE_INFINITY, |
| 88 |
eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") ); |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
new TestCase( |
| 93 |
SECTION, |
| 94 |
"var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity", |
| 95 |
Number.POSITIVE_INFINITY, |
| 96 |
eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") ); |
| 97 |
|
| 98 |
|
| 99 |
test(); |
| 100 |
|
| 101 |
function WithObject( value ) { |
| 102 |
this.prop1 = 1; |
| 103 |
this.prop2 = new Boolean(true); |
| 104 |
this.prop3 = "a string"; |
| 105 |
this.value = value; |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
this.parseInt = new Function( "return this.value" ); |
| 110 |
this.NaN = value; |
| 111 |
this.Infinity = value; |
| 112 |
this.unescape = new Function( "return this.value" ); |
| 113 |
this.escape = new Function( "return this.value" ); |
| 114 |
this.eval = new Function( "return this.value" ); |
| 115 |
this.parseFloat = new Function( "return this.value" ); |
| 116 |
this.isNaN = new Function( "return this.value" ); |
| 117 |
this.isFinite = new Function( "return this.value" ); |
| 118 |
} |