mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
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:
parent
ea1bb05cb5
commit
ab9ae99954
4 changed files with 67 additions and 0 deletions
|
@ -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
|
||||
|
|
0
Tests/base/NSXMLNode/TestInfo
Normal file
0
Tests/base/NSXMLNode/TestInfo
Normal file
17
Tests/base/NSXMLNode/basic.m
Normal file
17
Tests/base/NSXMLNode/basic.m
Normal 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;
|
||||
}
|
45
Tests/base/NSXMLNode/kinds.m
Normal file
45
Tests/base/NSXMLNode/kinds.m
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue