Debian Codegraph @

js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T2.js

raw
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 Properties of the object being enumerated may be deleted during
7 enumeration
8 es5id: 12.6.4_A7_T2
9 description: >
10 Checking "for (var VariableDeclarationNoIn in Expression)
11 Statement" case
12 ---*/
13
14 var __obj, __accum;
15
16 __obj = Object.create(null);
17 __obj.aa = 1;
18 __obj.ba = 2;
19 __obj.ca = 3;
20
21 __accum="";
22
23 for (var __key in __obj){
24
25 erasator_T_1000(__obj,"b");
26
27 __accum+=(__key+__obj[__key]);
28
29 }
30
31 assert(
32 __accum === "aa1ca3" || __accum === "ca3aa1",
33 "Unexpected value: '" + __accum + "'"
34 );
35
36 // erasator is the hash map terminator
37 function erasator_T_1000(hash_map, charactr){
38 for (var key in hash_map){
39 if (key.indexOf(charactr)===0) {
40 delete hash_map[key];
41 };
42 }
43 }
44
45 reportCompare(0, 0);