Debian Codegraph @

js/src/tests/test262/language/arguments-object/S10.6_A5_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 A property is created with name length with property
7 attributes { DontEnum } and no others
8 es5id: 10.6_A5_T2
9 description: Checking if enumerating the arguments.length property fails
10 ---*/
11
12 //CHECK#1
13 function f1(){
14 for(var x in arguments){
15 if (x === "length"){
16 return false;
17 }
18 }
19 return true;
20 }
21
22 try{
23 if(!f1()){
24 throw new Test262Error("#1: A property length don't have attribute { DontEnum }");
25 }
26 }
27 catch(e){
28 throw new Test262Error("#1: arguments object don't exists");
29 }
30
31 //CHECK#2
32 var f2 = function(){
33 for(var x in arguments){
34 if (x === "length"){
35 return false;
36 }
37 }
38 return true;
39 }
40
41 try{
42 if(!f2()){
43 throw new Test262Error("#2: A property length don't have attribute { DontEnum }");
44 }
45 }
46 catch(e){
47 throw new Test262Error("#2: arguments object don't exists");
48 }
49
50 reportCompare(0, 0);