Debian Codegraph @

rhino/testsrc/tests/ecma_3/Array/15.4.4.4-001.js

raw symbols SCIP
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/. */
5
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 gTestfile = '15.4.4.4-001.js';
15 var UBound = 0;
16 var BUGNUMBER = 169795;
17 var summary = 'Testing Array.prototype.concat()';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
24 var x;
25
26
27 status = inSection(1);
28 x = "Hello";
29 actual = [].concat(x).toString();
30 expect = x.toString();
31 addThis();
32
33 status = inSection(2);
34 x = 999;
35 actual = [].concat(x).toString();
36 expect = x.toString();
37 addThis();
38
39 status = inSection(3);
40 x = /Hello/g;
41 actual = [].concat(x).toString();
42 expect = x.toString();
43 addThis();
44
45 status = inSection(4);
46 x = new Error("Hello");
47 actual = [].concat(x).toString();
48 expect = x.toString();
49 addThis();
50
51 status = inSection(5);
52 x = function() {return "Hello";};
53 actual = [].concat(x).toString();
54 expect = x.toString();
55 addThis();
56
57 status = inSection(6);
58 x = [function() {return "Hello";}];
59 actual = [].concat(x).toString();
60 expect = x.toString();
61 addThis();
62
63 status = inSection(7);
64 x = [1,2,3].concat([4,5,6]);
65 actual = [].concat(x).toString();
66 expect = x.toString();
67 addThis();
68
69 status = inSection(8);
70 x = eval('this');
71 actual = [].concat(x).toString();
72 expect = x.toString();
73 addThis();
74
75 /*
76 * The next two sections are by [email protected]; see
77 * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3
78 */
79 status = inSection(9);
80 x={length:0};
81 actual = [].concat(x).toString();
82 expect = x.toString();
83 addThis();
84
85 status = inSection(10);
86 x={length:2, 0:0, 1:1};
87 actual = [].concat(x).toString();
88 expect = x.toString();
89 addThis();
90
91
92
93 //-----------------------------------------------------------------------------
94 test();
95 //-----------------------------------------------------------------------------
96
97
98
99 function addThis()
100 {
101 statusitems[UBound] = status;
102 actualvalues[UBound] = actual;
103 expectedvalues[UBound] = expect;
104 UBound++;
105 }
106
107
108 function test()
109 {
110 enterFunc('test');
111 printBugNumber(BUGNUMBER);
112 printStatus(summary);
113
114 for (var i=0; i<UBound; i++)
115 {
116 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
117 }
118
119 exitFunc ('test');
120 }