Debian Codegraph @

js/src/tests/test262/language/arguments-object/S10.6_A5_T4.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_T4
9 description: Overriding arguments.length property
10 ---*/
11
12 var str = "something different";
13 //CHECK#1
14 function f1(){
15 arguments.length = str;
16 return arguments;
17 }
18
19 try{
20 if(f1().length !== str){
21 throw new Test262Error("#1: A property length have attribute { ReadOnly }");
22 }
23 }
24 catch(e){
25 throw new Test262Error("#1: arguments object don't exists");
26 }
27
28 //CHECK#2
29 var f2 = function(){
30 arguments.length = str;
31 return arguments;
32 };
33 try{
34 if(f2().length !== str){
35 throw new Test262Error("#2: A property length have attribute { ReadOnly }");
36 }
37 }
38 catch(e){
39 throw new Test262Error("#2: arguments object don't exists");
40 }
41
42 reportCompare(0, 0);