-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Update meck for OTP 18.0 #139
Conversation
@@ -1,7 +1,7 @@ | |||
%% Compiler Options =========================================================== | |||
{erl_opts, [ | |||
%% Erlang releases after 17 don't put R in front of their name, and also require dict() to be written like dict:dict() | |||
{platform_define, "^[0-9]+", namespaced_dicts}, | |||
{platform_define, "^[0-9]+", namespaced_types}, |
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.
Was there a functional reason for renaming namespaced_dicts
to namespaced_types
? (Apart from that it looks better?) 😄
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.
yeah, it does look a bit better :) but this is actually needed for meck_tests.erl to compile in 18.0 (those non-namespaced types are completely removed now). I tried to explain it in the commit message but let me know if I should make it clearer.
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.
Ah, you mean the define is needed, and the new name better describes it (because it is more general)? If so, then keep the change. 😄
Meck used to have 'namespaced_dict' while Hamcrest recently introduced a similar macro, 'namespaced_types' for the same purpose. In OTP 18.0 the affected non-namespaced types were completely removed and using them results in a compile error instead of deprecation wagning in 17. So hamcrest.hrl relies on the precense of 'namespaced_types' macro to use the right type. Meck's test module meck_tests.erl includes this header so the 'namespaced_types' macro also have to be defined in meck's test.config. To eliminate duplication I chose to unite the above two macros and use the more generic 'namespaced_types' name.
In order to avoid creating temporary files meck_cover needs direct access to some unexported functions of cover. In OTP 18.0 the internal API of cover changed a bit and compile_beam/2 (which allows passing a binary instead just a filename) was replaced by compile_beams/1. See erlang/otp@ab435488
6949836
to
e3c9d24
Compare
updated the code as agreed and extended the description of commit msq gomoripeti/meck@79cb5c9 |
Brilliant, thanks! |
In order to avoid creating temporary files meck_cover needs direct
access to some unexported functions of cover.
In OTP 18.0 the internal API of cover changed a bit and
compile_beam/2 (which allows passing a binary instead just a filename)
was replaced by compile_beams/1.
See erlang/otp@ab435488
Travis does not have OTP 18.0-rc1 yet but the unit tests pass on my machine
(with the namespaced types change)