michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Deleting property using "eval" statement containing "with" statement michael@0: * michael@0: * @path ch12/12.10/S12.10_A5_T5.js michael@0: * @description Deleting array property michael@0: * @noStrict michael@0: */ michael@0: michael@0: this.p1 = 'a'; michael@0: var myObj = { michael@0: p1: [1,2,3], michael@0: del:false michael@0: } michael@0: eval("with(myObj){del = delete p1}"); michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: try{ michael@0: if(myObj.p1[2] === 3){ michael@0: $ERROR('#1: myObj.p1[2] !== 3 '); michael@0: } michael@0: }catch(e){var x=1}; michael@0: if(x !== 1){ michael@0: $ERROR('#1: x === 1. Actual: x ==='+ x ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if(myObj.p1 !== undefined){ michael@0: $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#3 michael@0: if(myObj.del !== true){ michael@0: $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#4 michael@0: if(myObj.p1 === 'a'){ michael@0: $ERROR('#4: myObj.p1 !== \'a\''); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: