Fix extension configuration test #9715
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
I found that this test case doesn't play its expected role.
Vim/test/extension.test.ts
Line 33 in 0089b0e
This line has the following bugs:
keys.filter()
has a wrong condition that should be inverted to extract unhandled keys as expected.keys
contain the configuration keys prefixed withvim.
, whilehandlers
contain non-prefixed ones. For example,keys[]
is'vim.useCtrlKeys'
whilehandlers[]
is'useCtrlKeys'
.So comparing them with
handlers.includes(key)
doesn't make any sense and it never betrue
.Configuration
class (for example, the key'vim.cursorStylePerMode.normal'
will be mapped to{cursorStylePerMode: {normal: '<value>'}}
), so the comparison ofhandlers.includes(key)
doesn't work in such cases as well, because it compares the first-level object key likecursorStylePerMode
with the dot-concatenated key like'vim.cursorStylePerMode.normal'
.As a result of the combination of the wrong comparison (2) and the inverted boolean eval (1), the predicate returns the expected result (
unhandled = []
) by accident and the test has been passed. The problem (3) has also not been revealed due to it.This PR fixes these bugs.
As a result, the fixed test detected a missing property in
testConfiguration
, so it's also fixed in be84e5aWhich issue(s) this PR fixes
Special notes for your reviewer: