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:
rfm 2011-04-12 05:41:53 +00:00
parent e085dd6bb9
commit bf055f4e56
7 changed files with 142 additions and 87 deletions

View file

@ -1,3 +1,14 @@
2011-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSObjCRuntime.m (GSSelectorFromNameAndTypes):
Comment out case for __GNU_LIBOBJC__ to avoid breakage with gcc-4.6
* Source/NSPathUtilities.m: Minor tweak for running testcases.
* Tests/base/NSBundle/resources.m:
* Tests/base/NSBundle/basic.m:
Skip gnustep library bundle tests if not installed.
* Tests/base/NSNumberFormatter/basic.m:
Changed a test to a hope for the next release
2011-04-10 Quentin Mathe <quentin.mathe@gmail.com>
* Tools/AGSOutput.m (-fitWords:from:to:maxSize:output:): Ensure all

View file

@ -49,7 +49,11 @@ include ../Version
libgnustep-base_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
RESOURCE_SET_NAME = base-resources
ifeq ($(base-resources_INSTALL_DIR),)
base-resources_INSTALL_DIR = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/$(libgnustep-base_INTERFACE_VERSION)/Resources
endif
base-resources_LANGUAGES = English German French Italian TraditionalChinese \
Spanish Esperanto Korean
base-resources_LOCALIZED_RESOURCE_FILES = Localizable.strings

View file

@ -143,8 +143,13 @@ GSSelectorFromNameAndTypes(const char *name, const char *types)
{
#if NeXT_RUNTIME
return sel_getUid(name);
/* Don't use sel_registerTypedName() ... it's broken when first introduced
* into gcc (fails to correctly check for multple registrations with same
* types but different layout info).
*
#elif defined (__GNU_LIBOBJC__)
return sel_registerTypedName(name, types);
*/
#elif defined (__GNUSTEP_RUNTIME__)
return sel_registerTypedName_np(name, types);
#else

View file

@ -218,6 +218,8 @@ static NSString *gnustepUserDirDocumentation = nil;
static NSString *gnustepUserDirDocumentationInfo = nil;
static NSString *gnustepUserDirDocumentationMan = nil;
static NSString *uninstalled = nil;
static BOOL ParseConfigurationFile(NSString *name, NSMutableDictionary *dict,
NSString *userName);
@ -973,6 +975,8 @@ static void InitialisePathUtilities(void)
NSMutableDictionary *config;
[gnustep_global_lock lock];
ASSIGNCOPY(uninstalled, [[[NSProcessInfo processInfo] environment]
objectForKey: @"GNUSTEP_UNINSTALLED_LIBRARY_DIRECTORY"]);
gnustepUserName = [NSUserName() copy];
#if defined(__MINGW__)
{
@ -2026,6 +2030,12 @@ if (domainMask & mask) \
case NSLibraryDirectory:
{
/* We allow the environment to be used to specify the location of
* the resources of uninstalled libraries so that we can run tests
* on software prior to installation.
*/
ADD_PLATFORM_PATH(NSAllDomainsMask, uninstalled);
ADD_PLATFORM_PATH(NSUserDomainMask, gnustepUserLibrary);
ADD_PLATFORM_PATH(NSLocalDomainMask, gnustepLocalLibrary);
ADD_PLATFORM_PATH(NSNetworkDomainMask, gnustepNetworkLibrary);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -39,8 +39,10 @@ int main()
PASS(NO == [fmt getObjectValue: &num forString: @"1234.567"
errorDescription: 0], "float input is disallowed")
testHopeful = YES;
[fmt getObjectValue: &num forString: @"1234.567" errorDescription: &error];
PASS_EQUAL(error, @"Floating Point not allowed", "allowsFloat error")
testHopeful = NO;
[fmt setFormat: @"__000000"];
num = [[[NSNumber alloc] initWithFloat: 1234.432] autorelease];