Fix NSBundle test on Windows MSVC

This commit is contained in:
Hugo Melder 2022-08-03 16:15:45 +02:00
parent abd5223579
commit 6fac511e43
2 changed files with 13 additions and 2 deletions

View file

@ -1,9 +1,16 @@
ADDITIONAL_INCLUDE_DIRS += -I../GenericTests/ -I../../..
ADDITIONAL_OBJCFLAGS += -Wall
# OR operation to determine whether we are running on Windows, or MinGW.
# Windows does not support the concept of a run-time search path.
ifneq (,$(filter $(GNUSTEP_TARGET_OS),windows mingw32))
else
resources2_LDFLAGS += -Wl,-rpath -Wl,$(CURDIR)/Resources/TestFramework.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR)
resources2_LIB_DIRS += -L./Resources/TestFramework.framework/$(GNUSTEP_TARGET_LDIR)
resources2_TOOL_LIBS += -lTestFramework
endif
$(GNUSTEP_INSTANCE)_SUBPROJECTS = ../GenericTests

View file

@ -81,9 +81,9 @@ static void _testBundle(NSBundle* bundle, NSString* path, NSString* className)
PASS([arr containsObject: localPath],
"Returned array for 'German' contains localized resource");
Class clz = [bundle classNamed: className];
PASS(clz, "Class can be loaded from bundle");
PASS(clz != nil, "Class can be loaded from bundle");
id obj = [clz new];
PASS(obj, "Objects from bundle-loaded classes can be instantiated");
PASS(obj != nil, "Objects from bundle-loaded classes can be instantiated");
PASS_EQUAL([obj test], @"Something", "Correct method called");
[obj release];
}
@ -103,6 +103,9 @@ int main()
END_SET("Bundle")
START_SET("Framework")
#if defined(_WIN32)
SKIP("Adding a run-time search path is not supported on Windows.")
#else
/* This method call is required to ensure that the linker does not decide to
* elide the framework linkage.
*/
@ -111,6 +114,7 @@ int main()
path = [bundle bundlePath];
_testBundle(bundle, path, @"TestFramework");
PASS(0 == [bundle bundleVersion], "bundleVersion is zero");
#endif
END_SET("Framework");
[arp release]; arp = nil;