Debian Codegraph @

rhino/testsrc/tests/e4x/XMLList/13.5.4.8.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.8.js';
8
9 START("13.5.4.8 - XMLList copy()");
10
11 TEST(1, true, XMLList.prototype.hasOwnProperty("copy"));
12
13 emps = new XMLList();
14 emps += <employee id="0"><name>Jim</name><age>25</age></employee>;
15 emps += <employee id="1"><name>Joe</name><age>20</age></employee>;
16
17 correct = new XMLList();
18 correct += <employee id="0"><name>Jim</name><age>25</age></employee>;
19 correct += <employee id="1"><name>Joe</name><age>20</age></employee>;
20
21 TEST(2, emps, emps.copy());
22 TEST(3, correct, emps.copy());
23
24 // Make sure we're getting a copy, not a ref to orig.
25 emps = new XMLList();
26 emps += <employee id="0"><name>Jim</name><age>25</age></employee>;
27 emps += <employee id="1"><name>Joe</name><age>20</age></employee>;
28
29 correct = new XMLList();
30 correct += <employee id="0"><name>Jim</name><age>25</age></employee>;
31 correct += <employee id="1"><name>Joe</name><age>20</age></employee>;
32
33 x = emps.copy();
34
35 emps += <employee id="2"><name>Sue</name><age>32</age></employee>;
36
37 TEST(4, correct, x);
38
39 END();