Add some initial tests for NSXMLNode (will only pass on OS X, marked testHopeful for now).

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33903 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
thebeing 2011-09-28 18:10:18 +00:00
parent f597bf4c23
commit 3271491ce1
4 changed files with 67 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2011-09-28 Niels Grewe <niels.grewe@halbordnung.de>
* Tests/base/NSXMLNode/*: Some initial tests for NSXMLNode. Passes on
Mac OS X, marked as hopes until GNUstep implements this.
2011-09-19 Richard Frith-Macdonald <rfm@gnu.org>
* Version: Bump version and set required gcc to 4.0.0

View file

View file

@ -0,0 +1,17 @@
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLNode.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLNode *node;
node = [NSXMLNode new];
test_alloc(@"NSXMLNode");
test_NSObject(@"NSXMLNode", [NSArray arrayWithObject: node]);
[arp release];
arp = nil;
[node release];
return 0;
}

View file

@ -0,0 +1,45 @@
#import "Testing.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLNode.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import <Foundation/NSXMLDTD.h>
#import <Foundation/NSXMLDTDNode.h>
#define NODE_KIND_HAS_CLASS(node, kind, theClass) \
do \
{ \
node = [[NSXMLNode alloc] initWithKind: kind]; \
PASS([node isKindOfClass: [theClass class]], "Initializing with " #kind " produces instances of " #theClass "."); \
[node release]; \
node = nil; \
} while (0)
int main()
{
START_SET("NSXMLNode -initWithKind: initializer")
testHopeful = YES;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLNode *node;
NS_DURING
{
NODE_KIND_HAS_CLASS(node, NSXMLDocumentKind, NSXMLDocument);
NODE_KIND_HAS_CLASS(node, NSXMLElementKind, NSXMLElement);
NODE_KIND_HAS_CLASS(node, NSXMLDTDKind, NSXMLDTD);
NODE_KIND_HAS_CLASS(node, NSXMLEntityDeclarationKind, NSXMLDTDNode);
NODE_KIND_HAS_CLASS(node, NSXMLElementDeclarationKind, NSXMLDTDNode);
NODE_KIND_HAS_CLASS(node, NSXMLNotationDeclarationKind, NSXMLDTDNode);
node = [[NSXMLNode alloc] initWithKind: NSXMLAttributeDeclarationKind];
PASS (NO == [node isKindOfClass: [NSXMLDTDNode class]], "Does not instantiate NSXMLAttributeDeclarations through -initWithKind:");
[node release];
}
NS_HANDLER
{
PASS(YES == NO, "Failed testing NSXMLNode kinds");
}
NS_ENDHANDLER
[arp release];
arp = nil;
END_SET("NSXMLNode -initWithKind: initializer")
return 0;
}