Debian Codegraph @

rhino/testsrc/tests/e4x/Namespace/13.2.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.2.2.js';
8
9 START("13.2.2 - Namespace Constructor");
10
11 n = new Namespace();
12 TEST(1, "object", typeof(n));
13 TEST(2, "", n.prefix);
14 TEST(3, "", n.uri);
15
16 n = new Namespace("");
17 TEST(4, "object", typeof(n));
18 TEST(5, "", n.prefix);
19 TEST(6, "", n.uri);
20
21 n = new Namespace("http://foobar/");
22 TEST(7, "object", typeof(n));
23 TEST(8, "undefined", typeof(n.prefix));
24 TEST(9, "http://foobar/", n.uri);
25
26 // Check if the undefined prefix is getting set properly
27 m = new Namespace(n);
28 TEST(10, typeof(n), typeof(m));
29 TEST(11, n.prefix, m.prefix);
30 TEST(12, n.uri, m.uri);
31
32 n = new Namespace("foobar", "http://foobar/");
33 TEST(13, "object", typeof(n));
34 TEST(14, "foobar", n.prefix);
35 TEST(15, "http://foobar/", n.uri);
36
37 // Check if all the properties are getting copied
38 m = new Namespace(n);
39 TEST(16, typeof(n), typeof(m));
40 TEST(17, n.prefix, m.prefix);
41 TEST(18, n.uri, m.uri);
42
43 try {
44 n = new Namespace("ns", "");
45 SHOULD_THROW(19);
46 } catch(ex) {
47 TEST(19, "TypeError", ex.name);
48 }
49
50 END();