-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests for GSFFIInvocation #466
base: master
Are you sure you want to change the base?
Conversation
Tests/base/GSFFIInvocation/string.m
Outdated
NSString *fakeUpperCaseString = [fakeString uppercaseString]; | ||
|
||
PASS_EQUAL(upperCaseString, fakeUpperCaseString, "uppercaseString selector is forwarded from the fake string to the actual NSString object"); | ||
NSLog(@"Upper case string: %@, fake upper case string: %@", upperCaseString, fakeUpperCaseString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should move this line before the test line, otherwise you never see the output for test failures and only there it is relevant.
Thank you for this test case, this seems very interesting. What I don't understand is, why only one of the tests seems to fail. Shouldn't both behave the same? Sorry, my bad, they both fail, so having just one test case would be enough. |
// Forward any invocation to the original item if it supports it... | ||
if ([_originalItem respondsToSelector:selector]) | ||
[invocation invokeWithTarget:_originalItem]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the else case you should call the super implementation, to make sure we end up in -doesNotRecognizeSelector:. This won't change the problem, just document the correct way to implement this method.
@davidchisnall could you please have a look at this issue? The most likely cause seems to be a difference in the bevahiour of libobjc2 on Windows. |
Thanks @fredkiefer , I made the changes you requested. You are correct: both tests fail. We can probably keep the |
For completeness: If, in |
You most likely also get a working result if you don't implement the method -forwardingTargetForSelector:, which is a speed up for libobjc2. |
That's correct; I split the test in two -- one which implements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look good to me.
This has been fixed in libobjc2 (gnustep/libobjc2#313) and the fix is being backported to MSYS (msys2/MINGW-packages#22538). I suggest we wait for MSYS to get the libobjc2 fix, after which CI should be green(er) again. |
Selector forwarding from one object to another seems to be broken when using libobjc2 on Windows (see also: gnustep/plugins-themes-WinUXTheme#7 (comment)).
This PR contains two tests which both pass on Linux, pass on Windows when using the GCC runtime, and fail on Windows when using libobjc2 to demonstrate the problem (and verify a fix).