Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.33k stars 118 forks source link

Generated instructions in automated test can't execute correctly on Windows #1996

Open Super-Xray opened 2 weeks ago

Super-Xray commented 2 weeks ago

Description

Reproduction steps

  1. Start the Ruby LSP using a certain editor
  2. Open the ruby test file(for example test\requests\definition_expectations_test.rb)
  3. click run in terminal attached to a test function
  4. 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
  5. 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!

andyw8 commented 2 weeks ago

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.