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

fix the doc test for cachex #387

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xiaoqianghan
Copy link

@xiaoqianghan xiaoqianghan commented Oct 22, 2024

Our application relies heavily on Cachex as our local caching solution.
Recently, while upgrading to Cachex 4.0, I noticed some changes in the Cachex.export/2 method. Specifically, the entry structure changed (the order of value and ttl was swapped), but this wasn't updated in the doctests and then discovered that the Cachex doctests weren't actually being used.

After adding doctest Cachex, I encountered a series of test failures. This PR is an attempt to fix the failing tests in the doctests. Here are the main points:

  • Assign a unique cache name based on the function name for each function's doctest. This prevents the ":already_started" error that occurs when using the same :my_cache name repeatedly.
  • Wrap example code using fictional module names like MyWarmer and MyHook in code blocks instead of using the iex> prefix.

I'm unsure if these changes will affect the readability of the generated documentation. Feel free to add comments or require modifications.

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.

1 participant