S12.2_A2.js (1724B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Variables are defined with global scope (that is, they are created as 7 members of the global object, as described in 10.1.3) using property 8 attributes { DontDelete} 9 es5id: 12.2_A2 10 description: > 11 Checking if deleting global variables that have the attributes 12 {DontDelete} fails 13 flags: [noStrict] 14 ---*/ 15 16 ////////////////////////////////////////////////////////////////////////////// 17 //CHECK#1 18 if (delete(__variable)) { 19 throw new Test262Error('#1: delete(__variable)===false'); 20 } 21 // 22 ////////////////////////////////////////////////////////////////////////////// 23 24 ////////////////////////////////////////////////////////////////////////////// 25 //CHECK#2 26 if (delete(this["__variable"])) { 27 throw new Test262Error('#2: delete(this["__variable"])===false'); 28 } 29 // 30 ////////////////////////////////////////////////////////////////////////////// 31 32 33 var __variable; 34 var __variable = "defined"; 35 36 ////////////////////////////////////////////////////////////////////////////// 37 //CHECK#3 38 if (delete(__variable) | delete(this["__variable"])) { 39 throw new Test262Error('#3: (delete(__variable) | delete(this["__variable"]))===false' ); 40 } 41 // 42 ////////////////////////////////////////////////////////////////////////////// 43 44 ////////////////////////////////////////////////////////////////////////////// 45 //CHECK#4 46 if ((__variable !== "defined")|(this["__variable"] !=="defined")) { 47 throw new Test262Error('#4: __variable === "defined" and this["__variable"] ==="defined"'); 48 } 49 // 50 ////////////////////////////////////////////////////////////////////////////// 51 52 reportCompare(0, 0);