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

Mimic is not using a stub function if that function is called by a function in the same module #27

Closed
azzahidK opened this issue Jun 13, 2021 · 2 comments

Comments

@azzahidK
Copy link

azzahidK commented Jun 13, 2021

Hello,
So recently i realize if you call a function that have a stub with a function in the same module that does not have stub.
The second function is actually calling the original function of the stubbed function.
Is there a way to overcome this limitation and make the second function to call the stub instead of the original function.

Thank you.
PS: If it's not possible it's alright, I'll create a separate module that will be the one that i make as a module for stubbed function.

@jimsynz
Copy link
Contributor

jimsynz commented Jun 13, 2021

@azzahidK this has bit me too. The BEAM optimises calls to functions within a module, there are two ways to make it work:

  1. Call the inner function as if calling it from the outside (ie MyModule.inner_function()), or
  2. as you suggest, move it to another module.

@azzahidK
Copy link
Author

Thank you @jimsynz for the suggestion i'll try the first solution that you offer.

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

No branches or pull requests

2 participants