diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ant-test-files/ant-project/build.xml | 0 | ||||
-rwxr-xr-x | test/ant-test-files/bin/ant | 0 | ||||
-rwxr-xr-x | test/ant-test-files/bin/ant.exe | 0 | ||||
-rw-r--r-- | test/test_ant_build_classpath_command.vader | 29 | ||||
-rw-r--r-- | test/test_ant_find_project_root.vader | 35 |
5 files changed, 64 insertions, 0 deletions
diff --git a/test/ant-test-files/ant-project/build.xml b/test/ant-test-files/ant-project/build.xml new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/ant-test-files/ant-project/build.xml diff --git a/test/ant-test-files/bin/ant b/test/ant-test-files/bin/ant new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/ant-test-files/bin/ant diff --git a/test/ant-test-files/bin/ant.exe b/test/ant-test-files/bin/ant.exe new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/ant-test-files/bin/ant.exe diff --git a/test/test_ant_build_classpath_command.vader b/test/test_ant_build_classpath_command.vader new file mode 100644 index 00000000..5542a9d8 --- /dev/null +++ b/test/test_ant_build_classpath_command.vader @@ -0,0 +1,29 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + + Save $PATH + let $PATH = ale#path#Simplify(g:dir . '/ant-test-files/bin') + + let g:valid_project = 'ant-test-files/ant-project' + let g:invalid_project = 'ant-test-files/non-ant-project' + let g:command_tail = ' classpath' . ' -S' . ' -q' + +After: + Restore + + unlet! g:command_tail + unlet! g:valid_project + unlet! g:invalid_project + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return `cd '[dir]' && 'ant' classpath -S -q`): + call ale#test#SetFilename(valid_project . '/Main.java') + + AssertEqual + \ ale#path#CdString(ale#path#Simplify(g:dir . '/ant-test-files/ant-project')) + \ . ale#Escape('ant') + \ . g:command_tail, + \ ale#ant#BuildClasspathCommand(bufnr('')) 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('')) |