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: * Changing property using "eval" statement containing "with" statement michael@0: * michael@0: * @path ch12/12.10/S12.10_A4_T4.js michael@0: * @description Changing object property michael@0: * @noStrict michael@0: */ michael@0: michael@0: this.p1 = 'a'; michael@0: var myObj = { michael@0: p1: {a:"hello"}, michael@0: } michael@0: eval("with(myObj){p1={b:'hi'}}"); michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if(myObj.p1.a === "hello"){ michael@0: $ERROR('#1: myObj.p1.a !== "hello"'); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if(myObj.p1.b !== "hi"){ michael@0: $ERROR('#2: myObj.p1.b === "hi". Actual: myObj.p1.b ==='+ myObj.p1.b ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#3 michael@0: if(myObj.p1 === 'a'){ michael@0: $ERROR('#3: myObj.p1 !== \'a\''); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: