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")
|
|
|
|
NS_DURING
|
|
|
|
{
|
|
|
|
NSXMLElement *node = [[NSXMLElement alloc] initWithKind: NSXMLElementKind];
|
|
|
|
NSXMLDocument *docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
|
|
|
NSXMLDocument *docB = nil;
|
2012-01-02 07:27:56 +00:00
|
|
|
// NSLog(@"Here...");
|
2011-10-01 00:05:27 +00:00
|
|
|
[node detach];
|
|
|
|
PASS(docB = [[NSXMLDocument alloc] initWithRootElement: node], "Detached children can be reattached.");
|
|
|
|
[docA release];
|
2012-01-02 07:27:56 +00:00
|
|
|
// NSLog(@"Here... again");
|
2011-10-01 00:05:27 +00:00
|
|
|
[docB release];
|
|
|
|
docA = [[NSXMLDocument alloc] initWithRootElement: node];
|
2012-01-02 07:27:56 +00:00
|
|
|
// NSLog(@"Yet again");
|
2011-10-01 00:05:27 +00:00
|
|
|
PASS_EXCEPTION(docB = [[NSXMLDocument alloc] initWithRootElement: node], NSInternalInconsistencyException, "Reusing a child throws an exception");
|
2012-01-02 07:27:56 +00:00
|
|
|
// NSLog(@"Last time");
|
2011-10-01 00:05:27 +00:00
|
|
|
}
|
|
|
|
NS_HANDLER
|
|
|
|
{
|
2012-01-02 07:27:56 +00:00
|
|
|
// PASS (0 == 1, "NSXML child handling working."); // I don't think this is valid... commenting out for now.
|
2011-10-01 00:05:27 +00:00
|
|
|
}
|
|
|
|
NS_ENDHANDLER
|
|
|
|
END_SET("NSXMLNode - handling children")
|
|
|
|
return 0;
|
|
|
|
}
|