NamedNodeMap tests - not complete yet

This commit is contained in:
jez 2009-11-25 10:24:21 +00:00
parent 283c48de75
commit 9a532b73cb

View file

@ -14,6 +14,7 @@ class NamedNodeMapTest : public TestCase
typedef string_adaptor SA; typedef string_adaptor SA;
typedef Arabica::DOM::Element<string_type, string_adaptor> Element; typedef Arabica::DOM::Element<string_type, string_adaptor> Element;
typedef Arabica::DOM::Node<string_type, string_adaptor> Node;
typedef Arabica::DOM::NamedNodeMap<string_type, string_adaptor> NamedNodeMap; typedef Arabica::DOM::NamedNodeMap<string_type, string_adaptor> NamedNodeMap;
public: public:
@ -80,8 +81,10 @@ class NamedNodeMapTest : public TestCase
Element d = parse("<root a='one'/>").getDocumentElement(); Element d = parse("<root a='one'/>").getDocumentElement();
NamedNodeMap nm = d.getAttributes(); NamedNodeMap nm = d.getAttributes();
assertEquals(1, nm.getLength()); assertEquals(1, nm.getLength());
nm.removeNamedItem(s("a")); Node a = nm.removeNamedItem(s("a"));
assertEquals(0, nm.getLength()); assertEquals(0, nm.getLength());
nm.setNamedItem(a);
assertEquals(1, nm.getLength());
} // test4 } // test4
void test5() void test5()
@ -89,8 +92,10 @@ class NamedNodeMapTest : public TestCase
Element d = parse("<root xmlns:a='urn:a' a:a='one'/>").getDocumentElement(); Element d = parse("<root xmlns:a='urn:a' a:a='one'/>").getDocumentElement();
NamedNodeMap nm = d.getAttributes(); NamedNodeMap nm = d.getAttributes();
assertEquals(2, nm.getLength()); assertEquals(2, nm.getLength());
nm.removeNamedItemNS(s("urn:a"), s("a")); Node a = nm.removeNamedItemNS(s("urn:a"), s("a"));
assertEquals(1, nm.getLength()); assertEquals(1, nm.getLength());
nm.setNamedItemNS(a);
assertEquals(2, nm.getLength());
} // test5 } // test5
}; };