mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Extend NSBundle test to check for framework resource loading.
This commit is contained in:
parent
d1af1d0244
commit
baa8e2465b
4 changed files with 28 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
2020-03-01 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Tests/base/NSBundle/TestInfo,
|
||||
* Tests/base/NSBundle/GNUmakefile.preamble,
|
||||
* Tests/base/NSBundle/resources2.m: Extend test to check for
|
||||
framework resource loading.
|
||||
|
||||
2020-02-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/objc-load.m: update GSPrivateSymbolPath() so that, on the
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
ADDITIONAL_INCLUDE_DIRS += -I../GenericTests/ -I../../..
|
||||
ADDITIONAL_OBJCFLAGS += -Wall
|
||||
|
||||
resources2_LIB_DIRS += -L./Resources/TestFramework.framework/$(GNUSTEP_TARGET_LDIR)
|
||||
resources2_TOOL_LIBS += -lTestFramework
|
||||
|
||||
$(GNUSTEP_INSTANCE)_SUBPROJECTS = ../GenericTests
|
||||
|
||||
SUBPROJECTS = ../GenericTests Resources
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./Resources/TestFramework.framework/Versions/0/
|
|
@ -11,15 +11,11 @@
|
|||
@end
|
||||
|
||||
|
||||
static void _testBundle(NSString* name, NSString* className)
|
||||
static void _testBundle(NSBundle* bundle, NSString* path, NSString* className)
|
||||
{
|
||||
NSBundle *bundle;
|
||||
NSArray *arr, *carr;
|
||||
NSString *path, *localPath;
|
||||
path = [[[[[NSFileManager defaultManager] currentDirectoryPath]
|
||||
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"]
|
||||
stringByAppendingPathComponent: name];
|
||||
bundle = [NSBundle bundleWithPath: path];
|
||||
NSString *localPath;
|
||||
|
||||
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil];
|
||||
PASS((arr && [arr count]),
|
||||
"-pathsForResourcesOfType:inDirectory: returns an array");
|
||||
|
@ -89,12 +85,24 @@ static void _testBundle(NSString* name, NSString* className)
|
|||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSString *path;
|
||||
NSBundle *bundle;
|
||||
|
||||
START_SET("Bundle")
|
||||
_testBundle(@"TestBundle.bundle", @"TestBundle");
|
||||
path = [[[[[NSFileManager defaultManager] currentDirectoryPath]
|
||||
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"]
|
||||
stringByAppendingPathComponent: @"TestBundle.bundle"];
|
||||
bundle = [NSBundle bundleWithPath: path];
|
||||
_testBundle(bundle, path, @"TestBundle");
|
||||
END_SET("Bundle")
|
||||
|
||||
START_SET("Framework")
|
||||
_testBundle(@"TestFramework.framework", @"TestFramework");
|
||||
bundle = [NSBundle bundleForClass: NSClassFromString(@"TestFramework")];
|
||||
path = [bundle bundlePath];
|
||||
_testBundle(bundle, path, @"TestFramework");
|
||||
PASS(0 == [bundle bundleVersion], "bundleVersion is zero");
|
||||
END_SET("Framework");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue