Debian Codegraph @

js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T1.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_T1
9 description: >
10 Checking "for (LeftHandSideExpression in Expression) Statement"
11 case
12 ---*/
13
14 var __obj, __accum, __key;
15
16 __obj={aa:1,ba:2,ca:3};
17
18 __accum="";
19
20 for (__key in __obj){
21
22 erasator_T_1000(__obj,"b");
23
24 __accum+=(__key+__obj[__key]);
25
26 }
27
28
29 //////////////////////////////////////////////////////////////////////////////
30 //CHECK#1
31 if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) {
32 throw new Test262Error('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)');
33 }
34 //
35 //////////////////////////////////////////////////////////////////////////////
36
37 //////////////////////////////////////////////////////////////////////////////
38 //CHECK#2
39 if (__accum.indexOf("ba2")!==-1) {
40 throw new Test262Error('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") );
41 }
42 //
43 //////////////////////////////////////////////////////////////////////////////
44
45
46 // erasator is the hash map terminator
47 function erasator_T_1000(hash_map, charactr){
48 for (var key in hash_map){
49 if (key.indexOf(charactr)===0) {
50 delete hash_map[key];
51 };
52 }
53 }
54
55 reportCompare(0, 0);