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

Show correct error when module has not yet been loaded #72

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

brain-geek
Copy link
Contributor

@brain-geek brain-geek commented Jul 14, 2024

I've been having wrong error message for cases when Mimic.copy has not been called. It has been showing Function .... not defined for .... This only happened when module has not been used/loaded prior.

It has been happening because function_exported? has an edge case documented in its docs:

Note that this function does not load the module in case it is not loaded. Check Code.ensure_loaded/1 for more information.

So, prior to this fix Mimic would mistakenly think that function does not exist, while it does exist though hasn't been loaded.

fixes #66

Copy link
Owner

@edgurgel edgurgel left a comment

Choose a reason for hiding this comment

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

LGTM!

@edgurgel edgurgel merged commit 738ed32 into edgurgel:main Jul 16, 2024
3 checks passed
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.

Intermittent Mimic.expect/4 test failure with Function not defined
2 participants