correct errors in test assumptions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39462 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-03-05 16:56:35 +00:00
parent f7c92fa78d
commit be89fe5c43
2 changed files with 15 additions and 16 deletions

View file

@ -9,33 +9,32 @@ int main()
NSString *path;
NSBundle *bundle;
path = [[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingPathComponent:@"Resources"];
path = [[[[NSFileManager defaultManager] currentDirectoryPath]
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"];
PASS([NSBundle mainBundle] != nil,
"+mainBundle returns non-nil if the tool has no bundle");
"+mainBundle returns non-nil if the tool has no bundle");
bundle = [NSBundle bundleWithPath:path];
[bundle retain];
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],
[[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,
[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,
PASS(arr != nil && [arr isKindOfClass: [NSArray class]] && [arr count] != 0,
"+allBundles returns an array");
}
[arp release]; arp = nil;

View file

@ -13,13 +13,13 @@ int main()
NSBundle *bundle;
NSArray *arr, *carr;
path = [[[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingPathComponent:@"Resources"]
stringByAppendingPathComponent: @"TestBundle.bundle"];
path = [[[[[NSFileManager defaultManager] currentDirectoryPath]
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"]
stringByAppendingPathComponent: @"TestBundle.bundle"];
/* --- [NSBundle -pathsForResourcesOfType:inDirectory:] --- */
bundle = [NSBundle bundleWithPath: path];
arr = [bundle pathsForResourcesOfType:@"txt" inDirectory: nil];
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil];
PASS((arr && [arr count]),
"-pathsForResourcesOfType:inDirectory: returns an array");
localPath = [path stringByAppendingPathComponent:
@ -32,12 +32,12 @@ int main()
"Returned array contains localized resource");
/* --- [NSBundle +pathsForResourcesOfType:inDirectory:] --- */
carr = [NSBundle pathsForResourcesOfType:@"txt" inDirectory: path];
carr = [NSBundle pathsForResourcesOfType: @"txt" inDirectory: path];
PASS([arr isEqual: carr],
"+pathsForResourcesOfType:inDirectory: returns same array");
/* --- [NSBundle -pathsForResourcesOfType:inDirectory:forLocalization:] --- */
arr = [bundle pathsForResourcesOfType:@"txt" inDirectory: nil
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil
forLocalization: @"English"];
PASS((arr && [arr count]),
"-pathsForResourcesOfType:inDirectory:forLocalization returns an array");
@ -51,7 +51,7 @@ int main()
"Returned array contains localized resource");
/* --- [NSBundle -pathsForResourcesOfType:inDirectory:forLocalization:] --- */
arr = [bundle pathsForResourcesOfType:@"txt" inDirectory: nil
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil
forLocalization: @"en"];
PASS((arr && [arr count]),
"-pathsForResources... returns an array for 'en'");
@ -65,7 +65,7 @@ int main()
"Returned array for 'en' contains localized resource");
/* --- [NSBundle -pathsForResourcesOfType:inDirectory:forLocalization:] --- */
arr = [bundle pathsForResourcesOfType:@"txt" inDirectory: nil
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil
forLocalization: @"German"];
PASS((arr && [arr count]),
"-pathsForResources... returns an array for 'German'");