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

Erlang/OTP 21 Tuple Call support removed #272

Closed
tomciopp opened this issue Jun 20, 2018 · 5 comments
Closed

Erlang/OTP 21 Tuple Call support removed #272

tomciopp opened this issue Jun 20, 2018 · 5 comments

Comments

@tomciopp
Copy link

Version 21 of erlang has removed support for tuple calls which breaks compatibility with ESpec. Any thoughts on a migration strategy?

  Support for "tuple calls" have been removed from the
  run-time system. Tuple calls was an undocumented and
  unsupported feature which allowed the module argument
  for an apply operation to be a tuple: Var = dict:new(),
  Var:size(). This "feature" frequently caused confusion,
  especially when such call failed. The stacktrace would
  point out functions that don't exist in the source
  code.

  For legacy code that need to use parameterized modules
  or tuple calls for some other reason, there is a new
  compiler option called tuple_calls. When this option is
  given, the compiler will generate extra code that
  emulates the old behavior for calls where the module is
  a variable.
@antonmi
Copy link
Owner

antonmi commented Jun 24, 2018

Hi, @tomciopp !
It's bad news. I haven't had a chance to try OTP 21 yet, but it seems that we should deprecate "RSpec syntax":

expect(smth).to eq(smth)

And use this one:

expect smth1 |> to(eq smth2)

or this one:

smth1 |> should(eq smth2)

I will investigate soon.
Did you have a chance to run ESpec with OTP 21?

@tomciopp
Copy link
Author

I've attempted to run ESpec with OTP 21 but it immediately errors in the spec_helper file. It seems that the configuration itself requires tuple calls.

@antonmi antonmi self-assigned this Jul 1, 2018
@antonmi
Copy link
Owner

antonmi commented Jul 9, 2018

Hi, guys!
This PR removes the support of tuple calls.
So, ESpec will work with OTP 21.
Could you please fetch the latest master and test if everything ok?
Thank you!

@bblaszkow06
Copy link
Contributor

Hi! I've tested the master and it seemed fine. To make it work I had to remove old syntax from mocks so this example should be removed from README:

context "with old syntax" do
    before do: allow(SomeModule).to accept(:func, fn(a, b) -> a + b end)
    it do: expect SomeModule.func(1, 2) |> to(eq 3)
end

@antonmi
Copy link
Owner

antonmi commented Jul 19, 2018

Thanks @bblaszkow06 !
Yeap, I'm going to make changes in README.
And I will release 1.6 version soon.

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

No branches or pull requests

3 participants