Generated instructions in automated test can't execute correctly on Windows
Description
Reproduction steps
- Start the Ruby LSP using a certain editor
- Open the ruby test file(for example test\requests\definition_expectations_test.rb)
- click
run in terminalattached to a test function - the instruction is like
bundle exec ruby -Itest xxx/test/requests/definition_expectations_test.rb --name DefinitionExpectationsTest\#test_jumping_to_method_definitions_when_declaration_exists - output is not correct:
Code snippet or error message
# Running tests with run options --name DefinitionExpectationsTest\#test_jumping_to_method_definitions_when_declaration_exists --seed 868:
Finished tests in 0.001863s, 0.0000 tests/s, 0.0000 assertions/s.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
but If I modifed the instruction into bundle exec ruby -Itest xxx/test/requests/definition_expectations_test.rb --name DefinitionExpectationsTest#test_jumping_to_method_definitions_when_declaration_exists (just delete a '\')
and then, the ouput is better:
# Running tests with run options --name DefinitionExpectationsTest#test_jumping_to_method_definitions_when_declaration_exists --seed 47762:
.
Finished tests in 0.050074s, 19.9706 tests/s, 19.9706 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
The os is win11, I run it on VSCode 1.88.1. The extension edition is v0.5.20. But the starting info in the output window is Initializing Ruby LSP v0.16.7,I'm not very sure the role of edition in this phenomenon. I hope somebody can check it. Thanks!
Thanks for the report. We're using Shellwords.escape but this is intended for the Bourne shell, so probably isn't a valid approach for Windows. We'll need to look into that.
@Super-Xray Can you try this branch please? https://github.com/Shopify/ruby-lsp/pull/2109
Sure!
I think this problem has been solved. Thanks! @andyw8