diff options
author | fenuks <fenuks@o2.pl> | 2019-12-16 01:18:13 +0100 |
---|---|---|
committer | fenuks <fenuks> | 2020-10-02 10:03:14 +0200 |
commit | 4466c479900cbdc029d3091beedda5f1729851ae (patch) | |
tree | d7abcd838dfc0d7a6c257d098c3c3709ebebb6ae /test/test_maven_build_classpath_command.vader | |
parent | 7186b0437f0b2d1726d594c04e580f26746368fc (diff) | |
download | ale-4466c479900cbdc029d3091beedda5f1729851ae.zip |
Add tests for maven.vim file
Diffstat (limited to 'test/test_maven_build_classpath_command.vader')
-rw-r--r-- | test/test_maven_build_classpath_command.vader | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/test_maven_build_classpath_command.vader b/test/test_maven_build_classpath_command.vader new file mode 100644 index 00000000..2d8b38a5 --- /dev/null +++ b/test/test_maven_build_classpath_command.vader @@ -0,0 +1,48 @@ +Before: + Save $PATH + Save $PATHEXT + + let $PATHEXT = '.' + + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + let g:expected_wrapper = '' + if has('unix') + let g:expected_wrapper = 'mvnw' + else + let g:expected_wrapper = 'mvnw.cmd' + endif + +After: + Restore + + unlet! g:expected_wrapper + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should use 'mvnw' in classpath command if available): + call ale#test#SetFilename('maven-test-files/maven-java-project/module1/src/main/java/dummy1.java') + + AssertEqual + \ ale#path#CdString(ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module1')) + \ . ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module1/' . g:expected_wrapper) + \ . ' dependency:build-classpath', + \ ale#maven#BuildClasspathCommand(bufnr('')) + +Execute(Should use 'mvn' in classpath command if it is executable and 'mvnw' is unavailable): + call ale#test#SetFilename('maven-test-files/maven-java-project/module2/src/main/java/dummy2.java') + let $PATH .= (has('win32') ? ';' : ':') + \ . ale#path#Simplify(g:dir . '/maven-test-files') + + AssertEqual + \ ale#path#CdString(ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module2')) + \ . 'mvn dependency:build-classpath', + \ ale#maven#BuildClasspathCommand(bufnr('')) + +Execute(Should return empty string if maven cannot be executed): + call ale#test#SetFilename('maven-test-files/non-maven-project/src/main/java/dummy.java') + + AssertEqual + \ '', + \ ale#maven#BuildClasspathCommand(bufnr('')) |