summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-06-03 23:40:22 +0100
committerw0rp <devw0rp@gmail.com>2019-06-03 23:40:22 +0100
commiteb6015c6fd43d1630046556b2598e8c52c203e6a (patch)
tree443db3bb16d99f0bfe5e97f300488ca020cc81a8 /test
parent4496c9b3c12874477dc1971b3cb841f1d5f20d98 (diff)
downloadale-eb6015c6fd43d1630046556b2598e8c52c203e6a.zip
#2542 - Improve checkstyle project configuration
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/checkstyle_paths/google_checks.xml0
-rw-r--r--test/command_callback/checkstyle_paths/other_config.xml0
-rw-r--r--test/command_callback/test_checkstyle_command_callback.vader62
3 files changed, 62 insertions, 0 deletions
diff --git a/test/command_callback/checkstyle_paths/google_checks.xml b/test/command_callback/checkstyle_paths/google_checks.xml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/checkstyle_paths/google_checks.xml
diff --git a/test/command_callback/checkstyle_paths/other_config.xml b/test/command_callback/checkstyle_paths/other_config.xml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/checkstyle_paths/other_config.xml
diff --git a/test/command_callback/test_checkstyle_command_callback.vader b/test/command_callback/test_checkstyle_command_callback.vader
new file mode 100644
index 00000000..d775f9f2
--- /dev/null
+++ b/test/command_callback/test_checkstyle_command_callback.vader
@@ -0,0 +1,62 @@
+Before:
+ call ale#assert#SetUpLinterTest('java', 'checkstyle')
+ call ale#test#SetFilename('dummy.java')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The checkstyle callback should return the correct default value):
+ AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' %s'
+
+Execute(The checkstyle executable should be configurable):
+ let b:ale_java_checkstyle_executable = 'foobar'
+
+ AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
+
+Execute(Custom options should be supported):
+ let b:ale_java_checkstyle_options = '--foobar'
+
+ AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' --foobar %s'
+
+Execute(configuration files set in _config should be supported):
+ let b:ale_java_checkstyle_config = ale#path#Simplify(g:dir . '/checkstyle_paths/other_config.xml')
+
+ AssertLinter 'checkstyle',
+ \ ale#Escape('checkstyle')
+ \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/checkstyle_paths/other_config.xml'))
+ \ . ' %s'
+
+Execute(configuration files set in _options should be preferred over _config):
+ let b:ale_java_checkstyle_config = '/foo.xml'
+ let b:ale_java_checkstyle_options = '-c /bar.xml'
+
+ AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -c /bar.xml %s'
+
+ let b:ale_java_checkstyle_options = '-x -c /bar.xml'
+
+ AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -x -c /bar.xml %s'
+
+Execute(google_checks.xml should be detected automatically):
+ call ale#test#SetFilename('checkstyle_paths/test.java')
+
+ AssertLinter 'checkstyle',
+ \ ale#Escape('checkstyle')
+ \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/checkstyle_paths/google_checks.xml'))
+ \ . ' %s'
+
+Execute(Other relative paths should be supported):
+ let b:ale_java_checkstyle_config = 'checkstyle_paths/other_config.xml'
+
+ AssertLinter 'checkstyle',
+ \ ale#Escape('checkstyle')
+ \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/checkstyle_paths/other_config.xml'))
+ \ . ' %s'
+
+ call ale#test#SetFilename('checkstyle_paths/test.java')
+
+ let b:ale_java_checkstyle_config = 'other_config.xml'
+
+ AssertLinter 'checkstyle',
+ \ ale#Escape('checkstyle')
+ \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/checkstyle_paths/other_config.xml'))
+ \ . ' %s'