libs-base/Tests/base/NSBundle/create.m
Richard Frith-MacDonald 0fbbec5fc3 correct errors in test assumptions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39462 72102866-910b-0410-8b05-ffd578937521
2016-03-05 16:56:35 +00:00

42 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]
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"];
PASS([NSBundle mainBundle] != nil,
"+mainBundle returns non-nil if the tool has no bundle");
bundle = [NSBundle bundleWithPath: path];
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;
}