mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Minor fixups for release ... mostly avoid failed testcases.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32837 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
619fd8cfba
commit
b1745e7d9d
7 changed files with 142 additions and 87 deletions
|
@ -9,12 +9,21 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSBundle *classBundle, *gnustepBundle, *identifierBundle, *bundle;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
START_SET("NSBundle general")
|
||||
NSFileManager *fm;
|
||||
NSBundle *classBundle, *identifierBundle, *bundle;
|
||||
NSString *path, *exepath;
|
||||
|
||||
|
||||
fm = [NSFileManager defaultManager];
|
||||
|
||||
#if defined(GNUSTEP)
|
||||
START_SET("NSBundle GNUstep general")
|
||||
NSBundle *gnustepBundle;
|
||||
|
||||
gnustepBundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
if (nil == gnustepBundle)
|
||||
SKIP("it looks like GNUstep-base is not yet installed")
|
||||
|
||||
PASS((
|
||||
[(gnustepBundle = [NSBundle bundleForLibrary: @"gnustep-base"])
|
||||
isKindOfClass: [NSBundle class]]),
|
||||
|
@ -23,18 +32,6 @@ int main()
|
|||
PASS([gnustepBundle principalClass] == [NSObject class],
|
||||
"-principalClass returns NSObject for the +bundleForLibrary:gnustep-base");
|
||||
|
||||
classBundle = [NSBundle bundleForClass: [TestClass class]];
|
||||
|
||||
TEST_FOR_CLASS(@"NSBundle",classBundle,
|
||||
"+bundleForClass: makes a bundle for us");
|
||||
|
||||
NSLog(@"%@", [classBundle principalClass]);
|
||||
PASS([classBundle principalClass] == [TestClass class],
|
||||
"-principalClass returns TestClass for +bundleForClass:[TestClass class]");
|
||||
|
||||
PASS(classBundle == [NSBundle mainBundle],
|
||||
"-mainBundle is the same as +bundleForClass:[TestClass class]");
|
||||
|
||||
PASS([[gnustepBundle classNamed: @"NSArray"] isEqual: [NSArray class]]
|
||||
&& [[NSArray class] isEqual: [gnustepBundle classNamed: @"NSArray"]],
|
||||
"-classNamed returns the correct class");
|
||||
|
@ -51,6 +48,21 @@ int main()
|
|||
PASS([fm fileExistsAtPath: exepath],
|
||||
"-executablePath returns an executable path (gnustep bundle)");
|
||||
|
||||
END_SET("NSBundle GNUstep general")
|
||||
#endif
|
||||
|
||||
classBundle = [NSBundle bundleForClass: [TestClass class]];
|
||||
|
||||
TEST_FOR_CLASS(@"NSBundle",classBundle,
|
||||
"+bundleForClass: makes a bundle for us");
|
||||
|
||||
NSLog(@"%@", [classBundle principalClass]);
|
||||
PASS([classBundle principalClass] == [TestClass class],
|
||||
"-principalClass returns TestClass for +bundleForClass:[TestClass class]");
|
||||
|
||||
PASS(classBundle == [NSBundle mainBundle],
|
||||
"-mainBundle is the same as +bundleForClass:[TestClass class]");
|
||||
|
||||
path = [[[fm currentDirectoryPath]
|
||||
stringByAppendingPathComponent:@"Resources"]
|
||||
stringByAppendingPathComponent: @"TestBundle.bundle"];
|
||||
|
@ -73,6 +85,7 @@ int main()
|
|||
PASS(identifierBundle == nil,
|
||||
"+bundleWithIdentifier returns nil for non-existent identifier");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
END_SET("NSBundle general")
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,79 +7,89 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSBundle *bundle;
|
||||
NSBundle *gstepBundle;
|
||||
NSArray *arr;
|
||||
START_SET("NSBundle resources")
|
||||
NSBundle *bundle;
|
||||
NSArray *arr;
|
||||
|
||||
bundle = [NSBundle bundleWithPath: [[NSFileManager defaultManager]
|
||||
currentDirectoryPath]];
|
||||
gstepBundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
bundle = [NSBundle bundleWithPath: [[NSFileManager defaultManager]
|
||||
currentDirectoryPath]];
|
||||
|
||||
PASS([bundle isKindOfClass: [NSBundle class]],
|
||||
"+bundleWithPath returns anNSBundle");
|
||||
arr = [bundle pathsForResourcesOfType: @"m" inDirectory: nil];
|
||||
PASS([arr isKindOfClass: [NSArray class]] && [arr count],
|
||||
"-pathsForResourcesOfType: inDirectory: returns an array");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2"
|
||||
ofType: nil
|
||||
inDirectory: nil] == nil,
|
||||
"-pathForResource:ofType:inDirectory: works with nil args");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2" ofType: nil] == nil,
|
||||
"-pathForResource:ofType: works with nil type");
|
||||
PASS([bundle pathForResource: nil ofType: @"tiff"] == nil,
|
||||
"-pathForResource:ofType: works with nil name");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2" ofType: @""] == nil,
|
||||
"-pathForResource:ofType: works with empty type");
|
||||
PASS([bundle pathForResource: @"" ofType: @"tiff"] == nil,
|
||||
"-pathForResource:ofType: works with empty name");
|
||||
PASS([[bundle resourcePath] testEquals: [[bundle bundlePath]
|
||||
stringByAppendingPathComponent: @"Resources"]],
|
||||
"-resourcePath returns the correct path");
|
||||
|
||||
PASS([[NSBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: [[gstepBundle bundlePath]
|
||||
stringByAppendingPathComponent: @"NSTimeZones"]] testForString],
|
||||
"+pathForResource:ofType:inDirectory: works");
|
||||
|
||||
PASS([[NSBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: [[gstepBundle bundlePath]
|
||||
stringByAppendingPathComponent: @"NSTimeZones"] withVersion: 0]
|
||||
testForString],
|
||||
"+pathForResource:ofType:inDirectory:withVersion: works");
|
||||
PASS([bundle isKindOfClass: [NSBundle class]],
|
||||
"+bundleWithPath returns anNSBundle");
|
||||
arr = [bundle pathsForResourcesOfType: @"m" inDirectory: nil];
|
||||
PASS([arr isKindOfClass: [NSArray class]] && [arr count],
|
||||
"-pathsForResourcesOfType: inDirectory: returns an array");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2"
|
||||
ofType: nil
|
||||
inDirectory: nil] == nil,
|
||||
"-pathForResource:ofType:inDirectory: works with nil args");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2" ofType: nil] == nil,
|
||||
"-pathForResource:ofType: works with nil type");
|
||||
PASS([bundle pathForResource: nil ofType: @"tiff"] == nil,
|
||||
"-pathForResource:ofType: works with nil name");
|
||||
PASS([bundle pathForResource: @"hiwelf0-2" ofType: @""] == nil,
|
||||
"-pathForResource:ofType: works with empty type");
|
||||
PASS([bundle pathForResource: @"" ofType: @"tiff"] == nil,
|
||||
"-pathForResource:ofType: works with empty name");
|
||||
PASS([[bundle resourcePath] testEquals: [[bundle bundlePath]
|
||||
stringByAppendingPathComponent: @"Resources"]],
|
||||
"-resourcePath returns the correct path");
|
||||
|
||||
#if defined(GNUSTEP)
|
||||
START_SET("NSBundle GNUstep general")
|
||||
NSBundle *gnustepBundle;
|
||||
|
||||
arr = [gstepBundle pathsForResourcesOfType: @"m"
|
||||
inDirectory: @"NSTimeZones"];
|
||||
PASS(([arr isKindOfClass: [NSArray class]] && [arr count] > 0),
|
||||
"-pathsForResourcesOfType:inDirectory: returns an array");
|
||||
PASS([[gstepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: @"NSTimeZones"] testForString],
|
||||
"-pathForResource:ofType:inDirectory: finds a file");
|
||||
PASS([gstepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"8nicola8"
|
||||
inDirectory: @"NSTimeZones"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: doesn't find a non-existing file");
|
||||
PASS([gstepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: @"NSTimeZones_dummy"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: doesn't find files in"
|
||||
"a non-existing dir");
|
||||
PASS([[gstepBundle pathForResource: @"abbreviations"
|
||||
ofType: nil
|
||||
inDirectory: @"NSTimeZones"] testForString],
|
||||
"-pathForResource:ofType:inDirectory: with nil type finds a file");
|
||||
PASS([gstepBundle pathForResource: @"whasssdlkf"
|
||||
ofType: nil
|
||||
inDirectory: @"NSTimeZones"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: with nil type doesn't find"
|
||||
"non-existing files");
|
||||
gnustepBundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
if (nil == gnustepBundle)
|
||||
SKIP("it looks like GNUstep-base is not yet installed")
|
||||
|
||||
PASS([[NSBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: [[gnustepBundle bundlePath]
|
||||
stringByAppendingPathComponent: @"NSTimeZones"]] testForString],
|
||||
"+pathForResource:ofType:inDirectory: works");
|
||||
|
||||
PASS([[gstepBundle pathForResource: @"NSTimeZones" ofType: nil]
|
||||
testForString],
|
||||
"-pathForResource:ofType: finds a file");
|
||||
[arp release]; arp = nil;
|
||||
PASS([[NSBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: [[gnustepBundle bundlePath]
|
||||
stringByAppendingPathComponent: @"NSTimeZones"] withVersion: 0]
|
||||
testForString],
|
||||
"+pathForResource:ofType:inDirectory:withVersion: works");
|
||||
|
||||
arr = [gnustepBundle pathsForResourcesOfType: @"m"
|
||||
inDirectory: @"NSTimeZones"];
|
||||
PASS(([arr isKindOfClass: [NSArray class]] && [arr count] > 0),
|
||||
"-pathsForResourcesOfType:inDirectory: returns an array");
|
||||
PASS([[gnustepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: @"NSTimeZones"] testForString],
|
||||
"-pathForResource:ofType:inDirectory: finds a file");
|
||||
PASS([gnustepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"8nicola8"
|
||||
inDirectory: @"NSTimeZones"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: doesn't find non-existing file");
|
||||
PASS([gnustepBundle pathForResource: @"abbreviations"
|
||||
ofType: @"plist"
|
||||
inDirectory: @"NSTimeZones_dummy"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: doesn't find files in"
|
||||
"a non-existing dir");
|
||||
PASS([[gnustepBundle pathForResource: @"abbreviations"
|
||||
ofType: nil
|
||||
inDirectory: @"NSTimeZones"] testForString],
|
||||
"-pathForResource:ofType:inDirectory: with nil type finds a file");
|
||||
PASS([gnustepBundle pathForResource: @"whasssdlkf"
|
||||
ofType: nil
|
||||
inDirectory: @"NSTimeZones"] == nil,
|
||||
"-pathForResource:ofType:inDirectory: with nil type doesn't find"
|
||||
"non-existing files");
|
||||
|
||||
PASS([[gnustepBundle pathForResource: @"NSTimeZones" ofType: nil]
|
||||
testForString],
|
||||
"-pathForResource:ofType: finds a file");
|
||||
|
||||
END_SET("NSBundle GNUstep resources")
|
||||
#endif
|
||||
END_SET("NSBundle resources")
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue