Add minimal scala support by axrt · Pull Request #312 · vim-test/vim-test · GitHub
Skip to content

Add minimal scala support#312

Merged
janko merged 6 commits into
vim-test:masterfrom
axrt:master
Aug 20, 2018
Merged

Add minimal scala support#312
janko merged 6 commits into
vim-test:masterfrom
axrt:master

Conversation

@axrt

@axrt axrt commented Aug 15, 2018

Copy link
Copy Markdown
Contributor

Hey janko-m,

First of all, thank you for the brilliant work, I am a huge fan, and use vim-test regularly to test my python, ruby and java!
Should you choose to include my contribution for scala testing through sbt, it would be my greatest pleasure.
I tested the solution, and it works fine for me, but as scala imposes way less formatting restrictions compared to java tests for instance, it is hard to create a file pattern regex to match all possible cases. If (when) I find a better one, I will definitely let you know.
Also, I am mostly using maven as scala is a mixin, rather than my primary tool. I will cut some time in the future to attach maven test to scala as well.

Thank you once again,

with my best wishes,

Alex T

@codeinabox codeinabox left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this. Would it possible to add a spec and fixture to test the implementation. Also could you update README amd doc/test.txt

@janko janko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you so much!

I left two small comments, and after they are addressed along and changes that @codeinabox requested, this should be ready to merge.

Comment thread plugin/test.vim Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to have this named SbtTest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed)

Comment thread autoload/test/scala/sbttest.vim Outdated
@@ -0,0 +1,39 @@
if !exists('g:test#scala#sbttest#file_pattern')
let g:test#scala#sbttest#file_pattern = '\v^.*.scala$'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make the test file regex match test files but not application files, e.g. \vsrc/test/scala/.*\.scala$? That helps make test.vim smarter, e.g. if you run tests on an application file, it would detect that it's not a test file and run tests for the last test file instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but I looked at our codebase at work, and it looks like it is overwhelmingly common for people to include "Test", "Suite", or both in the filename. I will work on an improved regex; so far, I created a fixture for scala, will create a spec and extend README tomorrow.

@axrt axrt force-pushed the master branch 4 times, most recently from 868d037 to 66403b6 Compare August 17, 2018 17:44
@axrt

axrt commented Aug 17, 2018

Copy link
Copy Markdown
Contributor Author

Ok, Travis is finally happy:)
I still did not figure out what to do about the messy files, like if the file is named differently and/or has more than one class defined (which scala inconveniently allowed), but it looks like the best way to go would be to pass down the class name as a parameter.

I guess it's good for now.
Thanks for reviewing!

@janko

janko commented Aug 20, 2018

Copy link
Copy Markdown
Member

@janko janko merged commit 08529c5 into vim-test:master Aug 20, 2018
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

Successfully merging this pull request may close these issues.

3 participants