summaryrefslogtreecommitdiff
path: root/test/test_ant_find_project_root.vader
diff options
context:
space:
mode:
authorAndrew Lee <andrew.lambda@tuta.io>2019-06-03 12:30:18 -0700
committerw0rp <w0rp@users.noreply.github.com>2019-06-03 20:30:18 +0100
commitc6a5cbb3c737261bc46477733b3aa26203eb63d9 (patch)
tree1b2cc8bf9b6eefd280df998bbb48d209dcf82708 /test/test_ant_find_project_root.vader
parenta76f056bd976a52d3d49f07726a067ac4dba2e6e (diff)
downloadale-c6a5cbb3c737261bc46477733b3aa26203eb63d9.zip
Feature/add ant support (#2539)
Use ant files to load Java settings too.
Diffstat (limited to 'test/test_ant_find_project_root.vader')
-rw-r--r--test/test_ant_find_project_root.vader35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_ant_find_project_root.vader b/test/test_ant_find_project_root.vader
new file mode 100644
index 00000000..bde33f00
--- /dev/null
+++ b/test/test_ant_find_project_root.vader
@@ -0,0 +1,35 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+ runtime ale_linters/java/javac.vim
+
+After:
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(Should return current directory if called on the project root):
+ call ale#test#SetFilename('ant-test-files/ant-project/Main.java')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
+ \ ale#ant#FindProjectRoot(bufnr(''))
+
+Execute(Should return root directory if called on a deeply nested source file):
+ call ale#test#SetFilename('ant-test-files/ant-project/src/several/namespace/layers/A.java')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
+ \ ale#ant#FindProjectRoot(bufnr(''))
+
+Execute(Should return empty string if called on a non-ant project):
+ call ale#test#SetFilename('ant-test-files/non-ant-project/Main.java')
+
+ AssertEqual
+ \ '',
+ \ ale#ant#FindProjectRoot(bufnr(''))
+
+Execute(Should return empty string if called on a file in a non-ant project):
+ call ale#test#SetFilename('ant-test-files/non-ant-project/several/namespace/layers/A.java')
+
+ AssertEqual
+ \ '',
+ \ ale#ant#FindProjectRoot(bufnr(''))