Debian Codegraph @

js/src/tests/test262/built-ins/Array/length/S15.4.2.2_A2.3_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 esid: sec-array-len
6 info: |
7 If the argument len is not a Number, then the length property of
8 the newly constructed object is set to 1 and the 0 property of
9 the newly constructed object is set to len
10 es5id: 15.4.2.2_A2.3_T3
11 description: Checking for boolean primitive and Boolean object
12 ---*/
13
14 var x = new Array("1");
15
16 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
17 assert.sameValue(x[0], "1", 'The value of x[0] is expected to be "1"');
18
19 var obj = new String("0");
20 var x = new Array(obj);
21
22 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
23 assert.sameValue(x[0], obj, 'The value of x[0] is expected to equal the value of obj');
24
25 reportCompare(0, 0);