rhino1.7.7.testsrc.tests.e4x.Expressions.11.3.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 = '11.3.1.js';
START("11.3.1 - Delete Operator");
order =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
// Delete the customer address
correct =
John
Doe
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
delete order.customer.address;
TEST_XML(1, "", order.customer.address);
TEST(2, correct, order);
order =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
// delete the custmomer ID
correct =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
delete order.customer.@id;
TEST_XML(3, "", order.customer.@id);
TEST(4, correct, order);
order =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
// delete the first item price
correct =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
delete order.item.price[0];
TEST_XML(5, "", order.item[0].price);
TEST(6, 1299.99 , order.item.price[0]);
TEST(7, order, correct);
order =
John
Doe
123 Foobar Ave.
Bellevue
WA
-
Big Screen Television
1299.99
1
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
// delete all the items
correct =
John
Doe
123 Foobar Ave.
Bellevue
WA
;
delete order.item;
TEST_XML(8, "", order.item);
TEST(9, correct, order);
default xml namespace = "http://someuri";
x = ;
x.a.b = "foo";
delete x.a.b;
TEST_XML(10, "", x.a.b);
var ns = new Namespace("");
x.a.b = foo;
delete x.a.b;
TEST(11, "foo", x.a.ns::b.toString());
delete x.a.ns::b;
TEST_XML(12, "", x.a.ns::b);
END();
© 2015 - 2024 Weber Informatics LLC | Privacy Policy