Debian Codegraph @

rhino/testsrc/tests/e4x/Types/9.2.1.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 = '9.2.1.9.js';
8
9 START("9.2.1.9 XMLList [[Equals]]");
10
11 // Empty list should equal undefined
12 TEST(1, true, (new XMLList() == undefined) && (undefined == new XMLList()));
13
14 // Compare two lists if all are equal
15 x = <alpha>one</alpha> + <bravo>two</bravo>;
16 y = <alpha>one</alpha> + <bravo>two</bravo>;
17 TEST(2, true, (x == y) && (y == x));
18 y = <alpha>one</alpha> + <bravo>two</bravo> + <charlie>three</charlie>;
19 TEST(3, false, (x == y) || (y == x));
20 y = <alpha>one</alpha> + <bravo>not</bravo>;
21 TEST(4, false, (x == y) || (y == x));
22
23 // If XMLList has one argument should compare with just the 0th element.
24 x = new XMLList(<alpha>one</alpha>);
25 y = <alpha>one</alpha>;
26 TEST(5, true, (x == y) && (y == x));
27 y = "one";
28 TEST(6, true, (x == y) && (y == x));
29
30 // Should return false even if list contains element equal to comparison
31 x = <alpha>one</alpha> + <bravo>two</bravo>;
32 y = <alpha>one</alpha>;
33 TEST(7, false, (x == y) && (y == x));
34
35 y = "<alpha>one</alpha>";
36 TEST(8, false, (x == y) || (y == x));
37
38 // Try other types - should return false
39 y = null;
40 TEST(9, false, (x == y) || (y == x));
41
42 y = new Object();
43 TEST(10, false, (x == y) || (y == x));
44
45 END();