This repository has been archived by the owner on May 30, 2024. It is now read-only.
Fix Run Current Test In Terminal for class line #961
Merged
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.
Motivation
Closes: Shopify/ruby-lsp#1743
Implementation
Previously, given this code
The test item called 'Foo' has children called 'test_one'. We set the 'testItem' to run with the value of the recursive method
findTestByActiveLine
. But in this case this will beundefined
, as the cursor is not in range oftest_one
. And as this is anelse_if
condition, we do not go through the assignation latter.I just reworked condition:
testItem
with thisFoo
test.Foo
andtest_one
, both can match the cursor range, but child have priority)undefined
, like that we keep the first assignationAutomated Tests
There are no automated tests for TestController, do you think it's worth it to avoid this kind of regression?
Manual Tests
Checkout this branch, and run tests with command with cursor at the top level of group (on class level for example)
record
Check the command output, first,
test_one
level, is suffixed by:7
, others are the top level command.