libs-base/Tests/base/NSBundle/create.m
Richard Frith-MacDonald 31098241ae Update to current release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@32970 72102866-910b-0410-8b05-ffd578937521
2011-05-03 13:19:28 +00:00

43 lines
1.3 KiB
Objective-C

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSFileManager.h>
#import "ObjectTesting.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *path;
NSBundle *bundle;
path = [[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingPathComponent:@"Resources"];
PASS([NSBundle mainBundle] != nil,
"+mainBundle returns non-nil if the tool has no bundle");
bundle = [NSBundle bundleWithPath:path];
[bundle retain];
TEST_FOR_CLASS(@"NSBundle", bundle, "+bundleWithPath returns a bundle");
TEST_STRING([bundle bundlePath],"a bundle has a path");
PASS([path isEqual:[bundle bundlePath]] &&
[[bundle bundlePath] isEqual:path],
"bundlePath returns the correct path");
TEST_FOR_CLASS(@"NSDictionary",[bundle infoDictionary],
"a bundle has an infoDictionary");
PASS([NSBundle bundleWithPath:
[path stringByAppendingPathComponent:@"nonexistent"]] == nil,
"+bundleWithPath returns nil for a non-existing path");
{
NSArray *arr = [NSBundle allBundles];
PASS(arr != nil && [arr isKindOfClass:[NSArray class]] && [arr count] != 0,
"+allBundles returns an array");
}
[arp release]; arp = nil;
return 0;
}