-
Notifications
You must be signed in to change notification settings - Fork 29
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
Declutter infoview tests. #104
Conversation
Codecov Report
@@ Coverage Diff @@
## main #104 +/- ##
==========================================
+ Coverage 92.15% 92.43% +0.28%
==========================================
Files 25 27 +2
Lines 1109 1243 +134
==========================================
+ Hits 1022 1149 +127
- Misses 87 94 +7
Continue to review full report at Codecov.
|
lua/tests/helpers.lua
Outdated
@@ -116,11 +122,130 @@ local function has_all(_, arguments) | |||
return true | |||
end | |||
|
|||
local prev_buf_max = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems quite fragile to me because it adds global mutable state to all infoview-touching test runs. Would really prefer if we avoided doing that, we're already struggling with #94 showing us we have too much mutable state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that you'd "opt-in" to on certain tests, and should be backwards compatible with the way we did things before (see e.g. infoview/lsp_spec.lua
). ISTM that mutable state is pretty much the only way to get this kind of coverage, and the mutable state before was just littered throughout the tests themselves rather than centralized in a helper (not to mention being hopelessly incomplete).
Did you perhaps mean #93? I'm pretty sure at this point the best way to handle it would be to:
- Split up
infoview/run_spec.lua
. - Add a feature to
nvim-lua/plenary.nvim
that allows tests to early-abort as soon as anit()
fails, so only the first error is shown.
@Julian Thanks for the nudge. What I had before was actually a pretty bad take, sorry for making you read through it. I pretty much overhauled this in the recent commit, it should hopefully be much easier to follow now! And at this point I think it gives 100% coverage of what I wanted to test. |
Will add more assert messages and split up |
…ithin `changed_win`.
Okay, should be good for a review now! The only last thing I want to do is add a few helpful assertion failure messages, will do soon. Also regarding #93, see aa8b0db, nvim-lua/plenary.nvim#196 and nvim-lua/plenary.nvim#197. |
Nice! Thanks for more fun upstream work, well done. Yeah sounds good to merge here then to me! |
Should also make testing infoview-specific stuff much more deliberate and complete!