Debian Codegraph @

js/src/tests/non262/regress/regress-419152.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 419152;
8 var summary = 'Shaver can not contain himself';
9 var actual = '';
10 var expect = '';
11
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 printBugNumber(BUGNUMBER);
20 printStatus (summary);
21
22 var a = [1,2,3];
23
24 a[5] = 6;
25 expect = '1,2,3,,,6:6';
26 actual = a + ':' + a.length;
27 reportCompare(expect, actual, summary + ': 1');
28
29 a = [1,2,3,4];
30 expect = 'undefined';
31 actual = a[-1] + '';
32 reportCompare(expect, actual, summary + ': 2');
33
34 a = [1,2,3];
35 a[-1] = 55;
36
37 expect = 3;
38 actual = a.length;
39 reportCompare(expect, actual, summary + ': 3');
40
41 expect = '1,2,3';
42 actual = a + '';
43 reportCompare(expect, actual, summary + ': 4');
44
45 expect = 55;
46 actual = a[-1];
47 reportCompare(expect, actual, summary + ': 5');
48
49 var s = "abcdef";
50
51 expect = 'undefined';
52 actual = s[-2] + '';
53 reportCompare(expect, actual, summary + ': 6');
54 }