2011-10-01 00:05:27 +00:00
|
|
|
#import "Testing.h"
|
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSXMLNode.h>
|
|
|
|
#import <Foundation/NSXMLDocument.h>
|
|
|
|
#import <Foundation/NSXMLElement.h>
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
START_SET("NSXMLNode - handling children")
|
2011-12-30 21:40:12 +00:00
|
|
|
// testHopeful = YES;
|
2011-10-01 00:05:27 +00:00
|
|
|
NS_DURING
|
|
|
|
{
|
|
|
|
NSXMLElement *node = [[NSXMLElement alloc] initWithKind: NSXMLElementKind];
|
|
|
|
NSXMLDocument *docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
|
|
|
NSXMLDocument *docB = nil;
|
|
|
|
[node detach];
|
|
|
|
PASS(docB = [[NSXMLDocument alloc] initWithRootElement: node], "Detached children can be reattached.");
|
|
|
|
[docA release];
|
|
|
|
[docB release];
|
|
|
|
docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
|
|
|
PASS_EXCEPTION(docB = [[NSXMLDocument alloc] initWithRootElement: node], NSInternalInconsistencyException, "Reusing a child throws an exception");
|
|
|
|
}
|
|
|
|
NS_HANDLER
|
|
|
|
{
|
|
|
|
PASS (0 == 1, "NSXML child handling working.");
|
|
|
|
}
|
|
|
|
NS_ENDHANDLER
|
|
|
|
END_SET("NSXMLNode - handling children")
|
|
|
|
return 0;
|
|
|
|
}
|