mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
* Source/NSXMLNode.m: Remove all the extra reference handling code
and the special retain and release methods. * Tests/base/NSXMLNode/basic.m, * Tests/base/NSXMLNode/children.m: A few more test cases. Validated on MacOSX 10.6. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34873 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
11e6e068de
commit
81fd43b4ce
4 changed files with 47 additions and 203 deletions
|
@ -10,10 +10,13 @@ int main()
|
|||
NSXMLNode *attr;
|
||||
|
||||
node = [[NSXMLNode alloc] initWithKind: NSXMLInvalidKind];
|
||||
test_alloc(@"NSXMLNode");
|
||||
test_NSObject(@"NSXMLNode", [NSArray arrayWithObject: node]);
|
||||
|
||||
other = [[NSXMLNode alloc] initWithKind: NSXMLElementKind];
|
||||
// We need to set the name, otherwise isEqual: wont work.
|
||||
[other setName: @"test"];
|
||||
test_alloc(@"NSXMLNode");
|
||||
test_NSObject(@"NSXMLNode", [NSArray arrayWithObjects: node, other, nil]);
|
||||
test_NSCopying(@"NSXMLNode", @"NSXMLNode", [NSArray arrayWithObjects: node, other, nil], NO, YES);
|
||||
|
||||
PASS(NO == [other isEqual: node], "different node kinds are not equal");
|
||||
[other release];
|
||||
|
||||
|
@ -39,7 +42,8 @@ int main()
|
|||
"setting object value on invalid node works");
|
||||
[node setObjectValue: nil];
|
||||
// Per documentation on NSXMLNode setObjectValue/objectValue,
|
||||
PASS_EQUAL([node objectValue], @"",
|
||||
// On 10.6 this returns nil not @""
|
||||
PASS_EQUAL([node objectValue], nil,
|
||||
"setting nil object value on invalid node works");
|
||||
[node setStringValue: @"aString"];
|
||||
PASS_EQUAL([node stringValue], @"aString",
|
||||
|
|
|
@ -13,20 +13,34 @@ int main()
|
|||
NSXMLElement *node = [[NSXMLElement alloc] initWithKind: NSXMLElementKind];
|
||||
NSXMLDocument *docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
||||
NSXMLDocument *docB = nil;
|
||||
NSXMLNode *attr;
|
||||
|
||||
// NSLog(@"Here...");
|
||||
[node detach];
|
||||
PASS(docB = [[NSXMLDocument alloc] initWithRootElement: node], "Detached children can be reattached.");
|
||||
[docA release];
|
||||
|
||||
// NSLog(@"Here... again");
|
||||
PASS(docB == [node parent], "Parent is set to docB");
|
||||
|
||||
[node setName: @"name"];
|
||||
attr = [NSXMLNode attributeWithName: @"key" stringValue: @"value"];
|
||||
[node addAttribute: attr];
|
||||
|
||||
PASS(node == [attr parent], "Attr parent is set to node");
|
||||
[docB release];
|
||||
PASS(nil == [node parent], "Parent is set to nil");
|
||||
docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
||||
// NSLog(@"Yet again");
|
||||
PASS_EXCEPTION(docB = [[NSXMLDocument alloc] initWithRootElement: node], NSInternalInconsistencyException, "Reusing a child throws an exception");
|
||||
// NSLog(@"Last time");
|
||||
}
|
||||
|
||||
//[node release];
|
||||
//[docA release];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
// PASS (0 == 1, "NSXML child handling working."); // I don't think this is valid... commenting out for now.
|
||||
PASS (NO, "NSXML child handling working."); // I don't think this is valid... commenting out for now.
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
END_SET("NSXMLNode - handling children")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue