Skip to content

Commit

Permalink
Add test for child de-/re-attachment behaviour in NSXML.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33920 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
ngrewe committed Oct 1, 2011
1 parent 223eb33 commit 4432b3d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-09-28 Niels Grewe <[email protected]>

* Tests/base/NSXMLNode/children.m: Test for child de-/re-attachment
behaviour.

2011-09-29 julian <[email protected]>

* Source/NSBundle.m: ([objectForInfoDictionaryKey:])
Expand Down
31 changes: 31 additions & 0 deletions Tests/base/NSXMLNode/children.m
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion Tests/base/NSXMLNode/kinds.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main()
}
NS_HANDLER
{
PASS(YES == NO, "Failed testing NSXMLNode kinds");
PASS(YES == NO, "NSXMLNode kinds working");
}
NS_ENDHANDLER
[arp release];
Expand Down

0 comments on commit 4432b3d

Please sign in to comment.