Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Function/length/S15.3.5.1_A3_T3.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_T3
7 description: >
8 Checking if varying the length property of
9 Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails
10 includes: [propertyHelper.js]
11 ---*/
12
13 var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
14
15 //CHECK#1
16 if (!(f.hasOwnProperty('length'))) {
17 $ERROR('#1: the function has length property.');
18 }
19
20 var flength = f.length;
21
22 verifyNotWritable(f, "length", null, function() {});
23
24 //CHECK#2
25 if (f.length !== flength) {
26 $ERROR('#2: the function.length property has the attributes ReadOnly');
27 }
28
29 //CHECK#3
30 try {
31 f.length();
32 $ERROR('#3: the function.length property has the attributes ReadOnly');
33 } catch (e) {
34 if (e instanceof Test262Error) throw e;
35 }
36
37 //CHECK#4
38 if (f.length !== 6) {
39 $ERROR('#4: the length property has the attributes { ReadOnly }');
40 }