From 4432b3d54de43e4fa6bd3bf8be0c87a98e8117a5 Mon Sep 17 00:00:00 2001 From: thebeing Date: Sat, 1 Oct 2011 00:05:27 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ Tests/base/NSXMLNode/children.m | 31 +++++++++++++++++++++++++++++++ Tests/base/NSXMLNode/kinds.m | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Tests/base/NSXMLNode/children.m diff --git a/ChangeLog b/ChangeLog index 49c8ccd49..789e3e54d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-28 Niels Grewe + + * Tests/base/NSXMLNode/children.m: Test for child de-/re-attachment + behaviour. + 2011-09-29 julian * Source/NSBundle.m: ([objectForInfoDictionaryKey:]) diff --git a/Tests/base/NSXMLNode/children.m b/Tests/base/NSXMLNode/children.m new file mode 100644 index 000000000..5ec682022 --- /dev/null +++ b/Tests/base/NSXMLNode/children.m @@ -0,0 +1,31 @@ +#import "Testing.h" +#import +#import +#import +#import + + +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; +} diff --git a/Tests/base/NSXMLNode/kinds.m b/Tests/base/NSXMLNode/kinds.m index 3ffc17af0..db8ba7a57 100644 --- a/Tests/base/NSXMLNode/kinds.m +++ b/Tests/base/NSXMLNode/kinds.m @@ -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];