Debian Codegraph @

rhino/testsrc/tests/e4x/XMLList/13.5.2.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.2.js';
8
9 START("13.5.2 - XMLList Constructor");
10
11 x = new XMLList();
12 TEST(1, "xml", typeof(x));
13 TEST(2, true, x instanceof XMLList);
14
15 // Load from another XMLList
16 // Make sure it is copied if it's an XMLList
17 x =
18 <>
19 <alpha>one</alpha>
20 <bravo>two</bravo>
21 </>;
22
23 y = new XMLList(x);
24
25 x += <charlie>three</charlie>;
26
27 TEST(3, "<alpha>one</alpha>\n<bravo>two</bravo>", y.toString());
28
29 // Load from one XML type
30 x = new XMLList(<alpha>one</alpha>);
31 TEST_XML(4, "<alpha>one</alpha>", x);
32
33 // Load from Anonymous
34 x = new XMLList(<><alpha>one</alpha><bravo>two</bravo></>);
35 TEST(5, "<alpha>one</alpha>\n<bravo>two</bravo>", x.toString());
36
37 // Load from Anonymous as string
38 x = new XMLList(<><alpha>one</alpha><bravo>two</bravo></>);
39 TEST(6, "<alpha>one</alpha>\n<bravo>two</bravo>", x.toString());
40
41 // Load from single textnode
42 x = new XMLList("foobar");
43 TEST_XML(7, "foobar", x);
44
45 x = XMLList(7);
46 TEST_XML(8, 7, x);
47
48 // Undefined and null should behave like ""
49 x = new XMLList(null);
50 TEST_XML(9, "", x);
51
52 x = new XMLList(undefined);
53 TEST_XML(10, "", x);
54
55 END();