Skip to content
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

Handle using nil as argument for andReturn in ObjC++ code. #404

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

dmaclach
Copy link
Contributor

Fix for #403.

This improves the special case handling of passing nil in return values to handle
C++ cases that previously weren't working.

Adds tests for C++11 and C++98 variants. To test fully tests need to be executed in both
32bit and 64 bit modes.

@dmaclach dmaclach force-pushed the realNil branch 2 times, most recently from de60c8b to 23c83e7 Compare May 7, 2020 15:53
@dmaclach dmaclach force-pushed the realNil branch 2 times, most recently from ed508f1 to 18214dd Compare May 24, 2020 16:00
erikdoe added a commit that referenced this pull request May 24, 2020
At this stage I am not sure whether to merge a few more (#419, #404, #398) and release as 3.6.1 or whether to include #421 (and maybe a variation on #394) and then release as 3.7.
@dmaclach
Copy link
Contributor Author

Anyone have any comments on this one? I think it's a no-brainer.

@dmaclach
Copy link
Contributor Author

Oops.. looks like Erik is looking at it as I type :) Apologies.

Fix for erikdoe#403.

This improves the special case handling of passing nil in return values to handle
C++ cases that previously weren't working.

Adds tests for C++11 and C++98 variants. To test fully tests need to be executed in both
32bit and 64 bit modes.
@dmaclach
Copy link
Contributor Author

Erik, do you have any plans you could share with regards to timing for OCMock 3.7, 3.8 etc? My pile of patches on my end is becoming a little scary :)

@erikdoe
Copy link
Owner

erikdoe commented Jul 13, 2020

So, the plan was/is to get out 3.7 very soon. I got sidetracked by the PR's regarding Swift Package Manager, but I have now concluded that they won't be in 3.7. So, there's only two open PR's which seem reasonably straight-forward. I was also debating with myself whether #398 should be in, but I haven't read all the comments over there in detail.

@dmaclach
Copy link
Contributor Author

dmaclach commented Jul 13, 2020 via email

@@ -547,7 +551,7 @@
2FA28006D043CBDBBAEF6E3F /* OCMMacroState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMMacroState.h; sourceTree = "<group>"; };
2FA280987F4EA8A4D79000D0 /* OCMMacroState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMMacroState.m; sourceTree = "<group>"; };
2FA280EB5E8CDEEAE76861F7 /* OCMNonRetainingObjectReturnValueProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMNonRetainingObjectReturnValueProvider.m; sourceTree = "<group>"; };
2FA2813F93050582D83E1499 /* OCMockObjectRuntimeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObjectRuntimeTests.m; sourceTree = "<group>"; };
2FA2813F93050582D83E1499 /* OCMockObjectRuntimeTests.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = OCMockObjectRuntimeTests.m; sourceTree = "<group>"; };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks the build for me. When I change the file type back to Objective-C it works. The error is:

/Users/erik/Projects/OCMock/Repositories/ocmock/Source/OCMockTests/OCMockObjectRuntimeTests.m:219:54: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'const char [4]'
XCTAssertNoThrow([[myMock expect] aSpecialMethod:"foo"], @"Should not complain about method with type qualifiers.");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh.. that is probably an accidental mod when I changed the file to objc++ before I broke the tests out into their own files. No need to pull that across. Apologies.

@erikdoe erikdoe merged commit b466d2e into erikdoe:master Jul 14, 2020
XCTAssertTrue([boxed isMethodReturnType:type2 compatibleWithValueType:type3]);
XCTAssertTrue([boxed isMethodReturnType:type3 compatibleWithValueType:type1]);
XCTAssertTrue([boxed isMethodReturnType:type3 compatibleWithValueType:type2]);
XCTAssertTrue([boxed isMethodReturnType:type1 compatibleWithValueType:type2 value:&value valueSize:valueSize]);
Copy link
Owner

@erikdoe erikdoe Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed these tests to pass NULL and 0 for the last two arguments. Couldn't see a reason why not, and it saved creating the value in the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants