summaryrefslogtreecommitdiff
path: root/test/test_maven_find_project_root.vader
diff options
context:
space:
mode:
authorfenuks <fenuks@o2.pl>2019-12-16 01:18:13 +0100
committerfenuks <fenuks>2020-10-02 10:03:14 +0200
commit4466c479900cbdc029d3091beedda5f1729851ae (patch)
treed7abcd838dfc0d7a6c257d098c3c3709ebebb6ae /test/test_maven_find_project_root.vader
parent7186b0437f0b2d1726d594c04e580f26746368fc (diff)
downloadale-4466c479900cbdc029d3091beedda5f1729851ae.zip
Add tests for maven.vim file
Diffstat (limited to 'test/test_maven_find_project_root.vader')
-rw-r--r--test/test_maven_find_project_root.vader28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_maven_find_project_root.vader b/test/test_maven_find_project_root.vader
new file mode 100644
index 00000000..3a2138d1
--- /dev/null
+++ b/test/test_maven_find_project_root.vader
@@ -0,0 +1,28 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+ runtime ale_linters/kotlin/javac.vim
+
+After:
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(Should return directory for 'mvnw' if found in parent directory):
+ call ale#test#SetFilename('maven-test-files/maven-java-project/module1/src/main/java/dummy1.java')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module1'),
+ \ ale#maven#FindProjectRoot(bufnr(''))
+
+Execute(Should return directory for 'pom.xml' if found in parent directory):
+ call ale#test#SetFilename('maven-test-files/maven-java-project/module2/src/main/java/dummy2.java')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module2'),
+ \ ale#maven#FindProjectRoot(bufnr(''))
+
+Execute(Should return empty string if maven files are not found in parent directory):
+ call ale#test#SetFilename('maven-test-files/non-maven-project/src/main/java/dummy.java')
+
+ AssertEqual
+ \ '',
+ \ ale#maven#FindProjectRoot(bufnr(''))