2011-02-16 08:21:17 +00:00
|
|
|
#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;
|
|
|
|
|
2016-03-05 16:56:35 +00:00
|
|
|
path = [[[[NSFileManager defaultManager] currentDirectoryPath]
|
|
|
|
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"];
|
2011-02-16 08:21:17 +00:00
|
|
|
|
|
|
|
PASS([NSBundle mainBundle] != nil,
|
2016-03-05 16:56:35 +00:00
|
|
|
"+mainBundle returns non-nil if the tool has no bundle");
|
2011-02-16 08:21:17 +00:00
|
|
|
|
2016-03-05 16:56:35 +00:00
|
|
|
bundle = [NSBundle bundleWithPath: path];
|
2011-02-16 08:21:17 +00:00
|
|
|
|
|
|
|
TEST_FOR_CLASS(@"NSBundle", bundle, "+bundleWithPath returns a bundle");
|
|
|
|
|
|
|
|
TEST_STRING([bundle bundlePath],"a bundle has a path");
|
|
|
|
|
|
|
|
PASS([path isEqual:[bundle bundlePath]] &&
|
2016-03-05 16:56:35 +00:00
|
|
|
[[bundle bundlePath] isEqual: path],
|
2011-02-16 08:21:17 +00:00
|
|
|
"bundlePath returns the correct path");
|
|
|
|
|
|
|
|
TEST_FOR_CLASS(@"NSDictionary",[bundle infoDictionary],
|
|
|
|
"a bundle has an infoDictionary");
|
|
|
|
|
|
|
|
PASS([NSBundle bundleWithPath:
|
2016-03-05 16:56:35 +00:00
|
|
|
[path stringByAppendingPathComponent: @"nonexistent"]] == nil,
|
2011-02-16 08:21:17 +00:00
|
|
|
"+bundleWithPath returns nil for a non-existing path");
|
|
|
|
|
|
|
|
{
|
|
|
|
NSArray *arr = [NSBundle allBundles];
|
2016-03-05 16:56:35 +00:00
|
|
|
PASS(arr != nil && [arr isKindOfClass: [NSArray class]] && [arr count] != 0,
|
2011-02-16 08:21:17 +00:00
|
|
|
"+allBundles returns an array");
|
|
|
|
}
|
|
|
|
[arp release]; arp = nil;
|
|
|
|
return 0;
|
|
|
|
}
|