Debian Codegraph @

rhino/testsrc/tests/js1_5/Array/regress-310351.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 var gTestfile = 'regress-310351.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 310351;
9 var summary = 'Convert host "list" objects to arrays';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var nodeList = [];
17 if (typeof document != 'undefined')
18 {
19 nodeList = document.getElementsByTagName('*');
20 }
21 else
22 {
23 printStatus('test using dummy array since no document available');
24 }
25
26 var array = Array.prototype.slice.call(nodeList, 0);
27
28 expect = 'Array';
29 actual = array.constructor.name;
30
31 // nodeList is live and may change
32 var saveLength = nodeList.length;
33
34 reportCompare(expect, actual, summary + ': constructor test');
35
36 expect = saveLength;
37 actual = array.length;
38
39 reportCompare(expect, actual, summary + ': length test');
40 expect = true;
41 actual = true;
42
43 for (var i = 0; i < saveLength; i++)
44 {
45 if (array[i] != nodeList[i])
46 {
47 actual = false;
48 summary += ' Comparison failed: array[' + i + ']=' + array[i] +
49 ', nodeList[' + i + ']=' + nodeList[i];
50 break;
51 }
52 }
53
54 reportCompare(expect, actual, summary + ': identical elements test');
55