Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
6 /*
7 *
8 * Date: 19 September 2002
9 * SUMMARY: Testing Array.prototype.concat()
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=169795
11 *
12 */
13 //-----------------------------------------------------------------------------
14 var UBound = 0;
15 var BUGNUMBER = 169795;
16 var summary = 'Testing Array.prototype.concat()';
17 var status = '';
18 var statusitems = [];
19 var actual = '';
20 var actualvalues = [];
21 var expect= '';
22 var expectedvalues = [];
23 var x;
26 status = inSection(1);
27 x = "Hello";
28 actual = [].concat(x).toString();
29 expect = x.toString();
30 addThis();
32 status = inSection(2);
33 x = 999;
34 actual = [].concat(x).toString();
35 expect = x.toString();
36 addThis();
38 status = inSection(3);
39 x = /Hello/g;
40 actual = [].concat(x).toString();
41 expect = x.toString();
42 addThis();
44 status = inSection(4);
45 x = new Error("Hello");
46 actual = [].concat(x).toString();
47 expect = x.toString();
48 addThis();
50 status = inSection(5);
51 x = function() {return "Hello";};
52 actual = [].concat(x).toString();
53 expect = x.toString();
54 addThis();
56 status = inSection(6);
57 x = [function() {return "Hello";}];
58 actual = [].concat(x).toString();
59 expect = x.toString();
60 addThis();
62 status = inSection(7);
63 x = [1,2,3].concat([4,5,6]);
64 actual = [].concat(x).toString();
65 expect = x.toString();
66 addThis();
68 status = inSection(8);
69 x = eval('this');
70 actual = [].concat(x).toString();
71 expect = x.toString();
72 addThis();
74 /*
75 * The next two sections are by igor@icesoft.no; see
76 * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3
77 */
78 status = inSection(9);
79 x={length:0};
80 actual = [].concat(x).toString();
81 expect = x.toString();
82 addThis();
84 status = inSection(10);
85 x={length:2, 0:0, 1:1};
86 actual = [].concat(x).toString();
87 expect = x.toString();
88 addThis();
92 //-----------------------------------------------------------------------------
93 test();
94 //-----------------------------------------------------------------------------
98 function addThis()
99 {
100 statusitems[UBound] = status;
101 actualvalues[UBound] = actual;
102 expectedvalues[UBound] = expect;
103 UBound++;
104 }
107 function test()
108 {
109 enterFunc('test');
110 printBugNumber(BUGNUMBER);
111 printStatus(summary);
113 for (var i=0; i<UBound; i++)
114 {
115 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
116 }
118 exitFunc ('test');
119 }