Debian Codegraph @

js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_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: the length property has the attributes { ReadOnly }
6 es5id: 15.3.5.1_A3_T2
7 description: >
8 Checking if varying the length property of
9 Function("arg1,arg2,arg3", null) fails
10 includes: [propertyHelper.js]
11 ---*/
12
13 var f = Function("arg1,arg2,arg3", null);
14
15 assert(f.hasOwnProperty('length'));
16
17 var flength = f.length;
18
19 verifyNotWritable(f, "length", null, function() {});
20
21 assert.sameValue(f.length, flength);
22
23 try {
24 f.length();
25 throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
26 } catch (e) {
27 if (e instanceof Test262Error) {
28 throw e;
29 }
30 }
31
32 if (f.length !== 3) {
33 throw new Test262Error('#4: the length property has the attributes { ReadOnly }');
34 }
35
36 // TODO: Convert to verifyProperty() format.
37
38 reportCompare(0, 0);