|
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 * Properties of the object being enumerated may be deleted during enumeration |
|
6 * |
|
7 * @path ch12/12.6/12.6.4/S12.6.4_A7_T2.js |
|
8 * @description Checking "for (var VariableDeclarationNoIn in Expression) Statement" case |
|
9 */ |
|
10 |
|
11 __obj={aa:1,ba:2,ca:3}; |
|
12 |
|
13 __accum=""; |
|
14 |
|
15 for (var __key in __obj){ |
|
16 |
|
17 erasator_T_1000(__obj,"b"); |
|
18 |
|
19 __accum+=(__key+__obj[__key]); |
|
20 |
|
21 } |
|
22 |
|
23 |
|
24 ////////////////////////////////////////////////////////////////////////////// |
|
25 //CHECK#1 |
|
26 if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { |
|
27 $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); |
|
28 } |
|
29 // |
|
30 ////////////////////////////////////////////////////////////////////////////// |
|
31 |
|
32 ////////////////////////////////////////////////////////////////////////////// |
|
33 //CHECK#2 |
|
34 if (__accum.indexOf("ba2")!==-1) { |
|
35 $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); |
|
36 } |
|
37 // |
|
38 ////////////////////////////////////////////////////////////////////////////// |
|
39 |
|
40 |
|
41 // erasator is the hash map terminator |
|
42 function erasator_T_1000(hash_map, charactr){ |
|
43 for (key in hash_map){ |
|
44 if (key.indexOf(charactr)===0) { |
|
45 delete hash_map[key]; |
|
46 }; |
|
47 } |
|
48 } |
|
49 |