Debian Codegraph @

js/src/tests/test262/language/arguments-object/S10.1.6_A1_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 The activation object is initialised with a property with name arguments
7 and attributes {DontDelete}
8 es5id: 10.1.6_A1_T2
9 description: Checking funtion which returns property "arguments"
10 ---*/
11
12 var ARG_STRING = "value of the argument property";
13
14 function f1() {
15 this.constructor.prototype.arguments = ARG_STRING;
16 return arguments;
17 }
18
19 //CHECK#1
20 if ((new f1(1,2,3,4,5)).length !== 5)
21 throw new Test262Error('#1: (new f1(1,2,3,4,5)).length===5, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"');
22
23 //CHECK#2
24 if ((new f1(1,2,3,4,5))[3] !== 4)
25 throw new Test262Error('#2: (new f1(1,2,3,4,5))[3]===4, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"');
26
27 //CHECK#3
28 var x = new f1(1,2,3,4,5);
29 if (delete x[3] !== true)
30 throw new Test262Error('#3.1: Function parameters have attribute {DontDelete}');
31
32 if (x[3] === 4)
33 throw new Test262Error('#3.2: Function parameters have attribute {DontDelete}');
34
35 reportCompare(0, 0);