* Source/NSXMLDocument.m

* Source/NSXMLDTD.m
	* Source/NSXMLDTDNode.m
	* Source/NSXMLElement.m
	* Source/NSXMLNode.m
	* Source/NSXMLPrivate.h: Reimplementation of all DOM classes based on
	libxml2.  Implementation of all methods using libxml2 functions.
	* Tests/base/NSXMLDocument/basic.m
	* Tests/base/NSXMLElement/attributes.m
	* Tests/base/NSXMLElement/children.m
	* Tests/base/NSXMLNode/basic.m
	* Tests/base/NSXMLNode/children.m
	* Tests/base/NSXMLNode/kinds.m: Changes to test for new functionality.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34789 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-02-20 03:40:15 +00:00
parent a2dbde8cec
commit f02339adda
13 changed files with 1702 additions and 559 deletions

View file

@ -7,6 +7,7 @@ int main()
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLNode *node;
NSXMLNode *other;
NSXMLNode *attr;
node = [[NSXMLNode alloc] initWithKind: NSXMLInvalidKind];
test_alloc(@"NSXMLNode");
@ -37,7 +38,8 @@ int main()
PASS_EQUAL([node objectValue], @"anObject",
"setting object value on invalid node works");
[node setObjectValue: nil];
PASS_EQUAL([node objectValue], nil,
// Per documentation on NSXMLNode setObjectValue/objectValue,
PASS_EQUAL([node objectValue], @"",
"setting nil object value on invalid node works");
[node setStringValue: @"aString"];
PASS_EQUAL([node stringValue], @"aString",
@ -49,6 +51,37 @@ int main()
[node release];
[other release];
// Equality tests.
node = [[NSXMLNode alloc] initWithKind: NSXMLElementKind];
other = [[NSXMLNode alloc] initWithKind: NSXMLElementKind];
[other setName: @"test"];
[node setName: @"test"];
PASS([node isEqual: other],
"Nodes with the same name are equal");
attr = [NSXMLNode attributeWithName: @"key"
stringValue: @"value"];
[node addAttribute:attr];
PASS(![node isEqual: other],
"Nodes with different attributes are NOT equal");
attr = [NSXMLNode attributeWithName: @"key"
stringValue: @"value"];
[other addAttribute:attr];
PASS([node isEqual: other],
"Nodes with the same attributes are equal");
[other setStringValue: @"value"];
PASS(![node isEqual: other],
"Nodes with different values are NOT equal");
[node setStringValue: @"value"];
PASS([node isEqual: other],
"Nodes with different values are equal");
[node release];
[other release];
[arp release];
arp = nil;