Merge pull request #252 from gnustep/NSBundle-msvc-tests

Fix NSBundle unit test on Windows MSVC
This commit is contained in:
Hugo Melder 2022-08-11 09:16:17 +02:00 committed by GitHub
commit 7aae489660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -14,6 +14,13 @@
* .gitignore:
Ignore .type files in the coding unit test directory.
2022-08-03 Hugo Melder <contact@hugomelder.com>
* Tests/base/NSBundle/GNUmakefile.preamble
* Tests/base/NSBundle/resources2.m
Exclude framework loading on Windows, as Windows lacks support
for run-time search paths.
2022-07-27 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSHTTPURLHandle.m:

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;