Debian Codegraph @

rhino/testsrc/tests/e4x/XMLList/13.5.4.9.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 gTestfile = '13.5.4.9.js';
8
9 START("13.5.4.9 - XMLList descendants()");
10
11 TEST(1, true, XMLList.prototype.hasOwnProperty("descendants"));
12
13 // From Martin Honnen
14
15 var gods = <gods>
16 <god>
17 <name>Kibo</name>
18 </god>
19 <god>
20 <name>Xibo</name>
21 </god>
22 </gods>;
23
24 var godList = gods.god;
25
26 var expect;
27 var actual;
28 var node;
29 var descendants = godList.descendants();
30
31 expect = 4;
32 actual = descendants.length();
33 TEST(2, expect, actual)
34
35 expect = 'nodeKind(): element, name(): name;\n' +
36 'nodeKind(): text, name(): null;\n' +
37 'nodeKind(): element, name(): name;\n' +
38 'nodeKind(): text, name(): null;\n';
39
40 actual = '';
41
42 for each (var xml in descendants) {
43 actual += 'nodeKind(): ' + xml.nodeKind() + ', name(): ' + xml.name() + ';\n';
44 }
45 TEST(4, expect, actual);
46
47 END();