rhino1.7.7.testsrc.tests.e4x.XMLList.13.5.1.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
gTestfile = '13.5.1.js';
START("13.5.1 - XMLList Constructor as Function");
x = XMLList();
TEST(1, "xml", typeof(x));
TEST(2, true, x instanceof XMLList);
// Make sure it's not copied if it's an XMLList
x =
<>
one
two
>;
y = XMLList(x);
TEST(3, x === y, true);
x += three ;
TEST(4, x === y, false);
// Load from one XML type
x = XMLList(one );
TEST_XML(5, "one ", x);
// Load from Anonymous
x = XMLList(<>one two >);
correct = new XMLList();
correct += one ;
correct += two ;
TEST_XML(6, correct.toString(), x);
// Load from Anonymous as string
x = XMLList(<>one two >);
correct = new XMLList();
correct += one ;
correct += two ;
TEST_XML(7, correct.toString(), x);
// Load from single textnode
x = XMLList("foobar");
TEST_XML(8, "foobar", x);
x = XMLList(7);
TEST_XML(9, "7", x);
// Undefined and null should behave like ""
x = XMLList(null);
TEST_XML(10, "", x);
x = XMLList(undefined);
TEST_XML(11, "", x);
END();
© 2015 - 2024 Weber Informatics LLC | Privacy Policy