Author: thebeing Date: Fri Jul 1 13:08:54 2016 New Revision: 39954 URL: http://svn.gna.org/viewcvs/gnustep?rev=39954&view=rev Log: Test framework loading as well (we recently had a fault there)
Added: libs/base/trunk/Tests/base/NSBundle/Resources/TestFramework.m - copied, changed from r39947, libs/base/trunk/Tests/base/NSBundle/Resources/TestBundle.m Modified: libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile libs/base/trunk/Tests/base/NSBundle/resources2.m Modified: libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile?rev=39954&r1=39953&r2=39954&view=diff ============================================================================== --- libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile (original) +++ libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile Fri Jul 1 13:08:54 2016 @@ -2,6 +2,7 @@ include $(GNUSTEP_MAKEFILES)/common.make BUNDLE_NAME = TestBundle +FRAMEWORK_NAME = TestFramework TestBundle_OBJC_FILES = TestBundle.m TestBundle_RESOURCE_FILES = NonLocalRes.txt @@ -9,6 +10,13 @@ TestBundle_LOCALIZED_RESOURCE_FILES = TextRes.txt TestBundle_NEEDS_GUI = NO + +TestFramework_OBJC_FILES = TestFramework.m +TestFramework_RESOURCE_FILES = NonLocalRes.txt +TestFramework_LANGUAGES = English French de +TestFramework_LOCALIZED_RESOURCE_FILES = TextRes.txt + + include $(GNUSTEP_MAKEFILES)/bundle.make - +include $(GNUSTEP_MAKEFILES)/framework.make check:: all Copied: libs/base/trunk/Tests/base/NSBundle/Resources/TestFramework.m (from r39947, libs/base/trunk/Tests/base/NSBundle/Resources/TestBundle.m) URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSBundle/Resources/TestFramework.m?p2=libs/base/trunk/Tests/base/NSBundle/Resources/TestFramework.m&p1=libs/base/trunk/Tests/base/NSBundle/Resources/TestBundle.m&r1=39947&r2=39954&rev=39954&view=diff ============================================================================== --- libs/base/trunk/Tests/base/NSBundle/Resources/TestBundle.m (original) +++ libs/base/trunk/Tests/base/NSBundle/Resources/TestFramework.m Fri Jul 1 13:08:54 2016 @@ -1,16 +1,16 @@ #import <Foundation/NSObject.h> #import <Foundation/NSString.h> -@interface TestBundle : NSObject +@interface TestFramework : NSObject { } -(NSString *)test; @end -@implementation TestBundle +@implementation TestFramework -(NSString *)test { - return @"Something"; + return @"Something"; } @end Modified: libs/base/trunk/Tests/base/NSBundle/resources2.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSBundle/resources2.m?rev=39954&r1=39953&r2=39954&view=diff ============================================================================== --- libs/base/trunk/Tests/base/NSBundle/resources2.m (original) +++ libs/base/trunk/Tests/base/NSBundle/resources2.m Fri Jul 1 13:08:54 2016 @@ -6,18 +6,19 @@ #import <Foundation/NSString.h> #import <Foundation/NSPathUtilities.h> -int main() +@interface NSObject (TestMock) +- (NSString*)test; +@end + + +static void _testBundle(NSString* name, NSString* className) { - NSAutoreleasePool *arp = [NSAutoreleasePool new]; - NSString *path, *localPath; NSBundle *bundle; NSArray *arr, *carr; - + NSString *path, *localPath; path = [[[[[NSFileManager defaultManager] currentDirectoryPath] stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"] - stringByAppendingPathComponent: @"TestBundle.bundle"]; - - /* --- [NSBundle -pathsForResourcesOfType:inDirectory:] --- */ + stringByAppendingPathComponent: name]; bundle = [NSBundle bundleWithPath: path]; arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil]; PASS((arr && [arr count]), @@ -77,7 +78,23 @@ @"Resources/de.lproj/TextRes.txt"]; PASS([arr containsObject: localPath], "Returned array for 'German' contains localized resource"); + Class clz = [bundle classNamed: className]; + PASS(clz, "Class can be loaded from bundle"); + id obj = [clz new]; + PASS(obj, "Objects from bundle-loaded classes can be instantiated"); + PASS_EQUAL([obj test], @"Something", "Correct method called"); + [obj release]; +} +int main() +{ + NSAutoreleasePool *arp = [NSAutoreleasePool new]; + START_SET("Bundle") + _testBundle(@"TestBundle.bundle", @"TestBundle"); + END_SET("Bundle") + START_SET("Framework") + _testBundle(@"TestFramework.framework", @"TestFramework"); + END_SET("Framework"); [arp release]; arp = nil; return 0; } _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs