Add test for child de-/re-attachment behaviour in NSXML.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33920 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
thebeing 2011-10-01 00:05:27 +00:00
parent 223eb3356c
commit 4432b3d54d
3 changed files with 37 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2011-09-28 Niels Grewe <niels.grewe@halbordnung.de>
* Tests/base/NSXMLNode/children.m: Test for child de-/re-attachment
behaviour.
2011-09-29 julian <julian@corecode.at> 2011-09-29 julian <julian@corecode.at>
* Source/NSBundle.m: ([objectForInfoDictionaryKey:]) * Source/NSBundle.m: ([objectForInfoDictionaryKey:])

View file

@ -0,0 +1,31 @@
#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")
testHopeful = YES;
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;
}

View file

@ -35,7 +35,7 @@ int main()
} }
NS_HANDLER NS_HANDLER
{ {
PASS(YES == NO, "Failed testing NSXMLNode kinds"); PASS(YES == NO, "NSXMLNode kinds working");
} }
NS_ENDHANDLER NS_ENDHANDLER
[arp release]; [arp release];