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: * If the property doesn't have the DontDelete attribute, remove the property michael@0: * michael@0: * @path ch11/11.4/11.4.1/S11.4.1_A3.3.js michael@0: * @description Checking declared variable michael@0: */ michael@0: michael@0: //CHECK#1 michael@0: try { michael@0: x = 1; michael@0: delete x; michael@0: x; michael@0: $ERROR('#1: x = 1; delete x; x is not exist'); michael@0: } catch (e) { michael@0: if (e instanceof ReferenceError !== true) { michael@0: $ERROR('#1: x = 1; delete x; x is not exist'); michael@0: } michael@0: } michael@0: michael@0: michael@0: //CHECK#2 michael@0: function MyFunction(){}; michael@0: MyFunction.prop = 1; michael@0: delete MyFunction.prop; michael@0: if (MyFunction.prop !== undefined) { michael@0: $ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + (MyFunction.prop)); michael@0: michael@0: } michael@0: michael@0: //CHECK#3 michael@0: function MyFunction(){}; michael@0: var MyObjectVar = new MyFunction(); michael@0: MyObjectVar.prop = 1; michael@0: delete MyObjectVar.prop; michael@0: if (MyObjectVar.prop !== undefined) { michael@0: $ERROR('#3: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + (MyObjectVar.prop)); michael@0: } michael@0: michael@0: //CHECK#4 michael@0: if (delete MyObjectVar !== false) { michael@0: $ERROR('#4: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false'); michael@0: } michael@0: michael@0: //CHECK#5 michael@0: function MyFunction(){}; michael@0: MyObjectNotVar = new MyFunction(); michael@0: MyObjectNotVar.prop = 1; michael@0: delete MyObjectNotVar.prop; michael@0: if (MyObjectNotVar.prop !== undefined) { michael@0: $ERROR('#5: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + (MyObjectNotVar.prop)); michael@0: } michael@0: michael@0: //CHECK#6 michael@0: if (delete MyObjectNotVar !== true) { michael@0: $ERROR('#6: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true'); michael@0: } michael@0: michael@0: