Skip to content
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

GradeTest on Windows #725

Open
Tarmean opened this issue Mar 23, 2023 · 1 comment
Open

GradeTest on Windows #725

Tarmean opened this issue Mar 23, 2023 · 1 comment

Comments

@Tarmean
Copy link

Tarmean commented Mar 23, 2023

Running gradle tests uses ./gradlew if the file exists, or gradle otherwise.

On windows with the default &shell=cmd.exe this leads to a cryptic

'.' is not recognized as an internal or external command,
operable program or batch file.

This is because cmd.exe uses the current directory by default and gets confused by the ./.
The relevant lines are

https://github.com/vim-test/vim-test/blob/master/autoload/test/java/gradletest.vim#L114
https://github.com/vim-test/vim-test/blob/master/autoload/test/kotlin/gradletest.vim#L67

An explicit check fixes the error but is a tad ugly:

function! test#java#gradletest#executable() abort
  if findfile('gradlew') ==# 'gradlew'
      if &shell =~? "cmd.exe$"
          return 'gradlew test'
      else
          return './gradlew test'
      endif
  else
      return 'gradle test'
  endif
endfunction

Is there some existing pattern to handle this problem in other test types?

@codeinabox
Copy link
Collaborator

Thank you for spotting this, does the issue just occur with Kotlin or other test runners?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants