Skip to content

test(conftest): exclude cache variables for diff_env #798

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

Merged
merged 1 commit into from
Sep 10, 2022

Conversation

akinomyoga
Copy link
Collaborator

Extracted from #791. Actually, this change is needed for #791, but @scop seems to be going to agree with merging this first, I separate the change here.

  • 973276a ignore mut variables in diff_env (conftest): I'd like to cache the regular expressions constructed from COMP_WORDBREAKS in c59655c. This means that the variables that hold the cache can be changed while completions, so they should be excluded from the diff_env test of the test suite.
    • Failing approach: I tried to implement it by ignore_env or by adding the variable names in this line, but it seems to fail because the variable contains newlines so that the linewise exclusion does not work. The current exclusion mechanism based on the linewise diff does not work properly for the variables that contain multiple lines.
    • I instead suggest excluding variables at the env output stage. Because such a code becomes long, I decided to define a helper function _comp__test_get_env for get_env in test/config/bashrc (just as a test helper add_comp_wordbreak_char).
    • A related discussion is how to tell the cache variables to the test framework.
      • (a) Since _comp_offset can be called by several places, it is not useful to add the variable names to ignore_env of all the tests for the completions that may call _comp_offset.
      • (b) As an alternate solution, we might add the variable names one by one in the helper function _comp__test_get_env, but that doesn't seem to be smart.
      • (c) In the current PR, I invented a prefix _mut_ for mutable variables to exclude them from the diff_env check. The thread at #539 about "Internal variables / mutable variables (caching)" is related.
      • (d) Another solution is to allow changing the variables _comp_* unlimitedly in the tests.

The description is the same as was in #791.

@scop
Copy link
Owner

scop commented Sep 10, 2022

Thanks!

@akinomyoga akinomyoga deleted the conftest-exclude-mut-env branch September 10, 2022 21:38
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.

2 participants