Debian Codegraph @

rhino/testsrc/tests/e4x/Expressions/11.5.1.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 = '11.5.1.js';
8
9 START("11.5.1 - Equality Operators");
10
11 x = <alpha>one</alpha>;
12 y = <alpha>one</alpha>;
13 TEST(1, true, (x == y) && (y == x));
14
15 // Should return false if comparison is not XML
16 y = "<alpha>one</alpha>";
17 TEST(2, false, (x == y) || (y == x));
18
19 y = undefined
20 TEST(3, false, (x == y) || (y == x));
21
22 y = null
23 TEST(4, false, (x == y) || (y == x));
24
25 // Should check logical equiv.
26 x = <alpha attr1="value1">one<bravo attr2="value2">two</bravo></alpha>;
27 y = <alpha attr1="value1">one<bravo attr2="value2">two</bravo></alpha>;
28 TEST(5, true, (x == y) && (y == x));
29
30 y = <alpha attr1="new value">one<bravo attr2="value2">two</bravo></alpha>;
31 TEST(6, false, (x == y) || (y == x));
32
33 m = new Namespace();
34 n = new Namespace();
35 TEST(7, true, m == n);
36
37 m = new Namespace("uri");
38 TEST(8, false, m == n);
39
40 n = new Namespace("ns", "uri");
41 TEST(9, true, m == n);
42
43 m = new Namespace(n);
44 TEST(10, true, m == n);
45
46 TEST(11, false, m == null);
47 TEST(12, false, null == m);
48
49 m = new Namespace("ns", "http://anotheruri");
50 TEST(13, false, m == n);
51
52 p = new QName("a");
53 q = new QName("b");
54 TEST(14, false, p == q);
55
56 q = new QName("a");
57 TEST(15, true, p == q);
58
59 q = new QName("http://someuri", "a");
60 TEST(16, false, p == q);
61
62 q = new QName(null, "a");
63 TEST(16, false, p == q);
64
65 END();