|
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 * Variables are defined with global scope (that is, they are created as members of the global object, as described in 10.1.3) using property attributes { DontDelete} |
|
6 * |
|
7 * @path ch12/12.2/S12.2_A2.js |
|
8 * @description Checking if deleting global variables that have the attributes {DontDelete} fails |
|
9 */ |
|
10 |
|
11 ////////////////////////////////////////////////////////////////////////////// |
|
12 //CHECK#1 |
|
13 if (delete(__variable)) { |
|
14 $ERROR('#1: delete(__variable)===false'); |
|
15 } |
|
16 // |
|
17 ////////////////////////////////////////////////////////////////////////////// |
|
18 |
|
19 ////////////////////////////////////////////////////////////////////////////// |
|
20 //CHECK#2 |
|
21 if (delete(this["__variable"])) { |
|
22 $ERROR('#2: delete(this["__variable"])===false'); |
|
23 } |
|
24 // |
|
25 ////////////////////////////////////////////////////////////////////////////// |
|
26 |
|
27 |
|
28 var __variable; |
|
29 var __variable = "defined"; |
|
30 |
|
31 ////////////////////////////////////////////////////////////////////////////// |
|
32 //CHECK#3 |
|
33 if (delete(__variable) | delete(this["__variable"])) { |
|
34 $ERROR('#3: (delete(__variable) | delete(this["__variable"]))===false' ); |
|
35 } |
|
36 // |
|
37 ////////////////////////////////////////////////////////////////////////////// |
|
38 |
|
39 ////////////////////////////////////////////////////////////////////////////// |
|
40 //CHECK#4 |
|
41 if ((__variable !== "defined")|(this["__variable"] !=="defined")) { |
|
42 $ERROR('#4: __variable === "defined" and this["__variable"] ==="defined"'); |
|
43 } |
|
44 // |
|
45 ////////////////////////////////////////////////////////////////////////////// |
|
46 |
|
47 |