mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-21 07:21:12 +00:00
* Source/NSXMLDTD.m * Source/NSXMLDTDNode.m * Source/NSXMLElement.m * Source/NSXMLNode.m * Source/NSXMLPrivate.h: Reimplementation of all DOM classes based on libxml2. Implementation of all methods using libxml2 functions. * Tests/base/NSXMLDocument/basic.m * Tests/base/NSXMLElement/attributes.m * Tests/base/NSXMLElement/children.m * Tests/base/NSXMLNode/basic.m * Tests/base/NSXMLNode/children.m * Tests/base/NSXMLNode/kinds.m: Changes to test for new functionality. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34789 72102866-910b-0410-8b05-ffd578937521
44 lines
1.5 KiB
Objective-C
44 lines
1.5 KiB
Objective-C
#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")
|
|
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, "NSXMLNode kinds working");
|
|
}
|
|
NS_ENDHANDLER
|
|
[arp release];
|
|
arp = nil;
|
|
END_SET("NSXMLNode -initWithKind: initializer")
|
|
return 0;
|
|
}
|